{
    "openapi": "3.1.0",
    "jsonSchemaDialect": "https://spec.openapis.org/oas/3.1/dialect/base",
    "info": {
        "title": "AnagenSys API",
        "version": "1.0.0",
        "description": "AnagenSys API (clinic, patient portal and integrations).\n\nAuthentication: team (Bearer from /auth/entrar), patient (Bearer from /portal/auth/entrar) and integrations (OAuth 2.0 client credentials at /oauth/token).\n\nEnvelope: success {\"ok\":true,\"dados\":…,\"meta\":{…}}; error {\"ok\":false,\"erro\":{\"codigo\",\"mensagem\",\"campos\"}} with the proper HTTP status and a stable code from the catalogue (components.schemas.Erro).\n\nConventions: X-Request-Id on every response (accepted on requests); rate limits with X-RateLimit-Limit/-Remaining/-Reset and Retry-After on 429; Idempotency-Key on POST (24 h); pagination pagina/por_pagina (max 100) with meta.total; filters f[field]=value, f[field][de]=, f[field][ate]=, f[field][em]=a,b; sorting ordem=field:asc,field2:desc; ISO 8601 dates with offset; money with 2 decimals and currency; explicit units (x-unidade); version in the path (/v1), breaking changes only in /v2, deprecations announced with Deprecation and Sunset headers.\n\nData protection: every request honours the permission matrix and scope; fields without permission are never returned; clinical reads are recorded in the immutable audit log.",
        "contact": {
            "name": "AnagenSys",
            "url": "https://anagen.pt"
        }
    },
    "servers": [
        {
            "url": "https://anagen.pt/api/v1",
            "description": "Clinic server"
        }
    ],
    "tags": [
        {
            "name": "Autenticação",
            "description": "Team sign-in (password → second factor → confidentiality term), refresh and sign-out."
        },
        {
            "name": "Portal — autenticação",
            "description": "Patient portal sign-in and registration."
        },
        {
            "name": "Integrações",
            "description": "Integration usage, event catalogue and webhook testing."
        },
        {
            "name": "Sessão",
            "description": "Who am I, menu, clinics, notifications, search and emergency access."
        },
        {
            "name": "Ficheiros",
            "description": "Upload and short-lived signed links."
        },
        {
            "name": "Perfil",
            "description": "Personal data, password, second factor and sessions."
        },
        {
            "name": "Permissões",
            "description": "Profile × module × scope (own, team, department, all) × phase matrix, permissions per position, hidden or read-only fields per profile, per-person exceptions and effective permissions per person."
        },
        {
            "name": "Auditoria",
            "description": "Immutable access and action log, with chain verification."
        },
        {
            "name": "Definições",
            "description": "Clinic and platform settings; test email."
        },
        {
            "name": "Modelos de IA",
            "description": "Local AI service first and external service as fallback, per use."
        },
        {
            "name": "Ajuda",
            "description": "Help Center, contextual help and System Manual."
        },
        {
            "name": "Agenda",
            "description": "Calendar by professional or room, appointments with server-side conflict checks, availability, occupancy, reminders, public appointment link, waiting list and personal read-only sync with external calendars."
        },
        {
            "name": "Fluxo do dia",
            "description": "Day board by station (to arrive, admission, preparation, extraction, implantation, recovery, exit) with time per station, and waiting-room screen with minimal data."
        },
        {
            "name": "Teleconsulta",
            "description": "Virtual waiting room, consent before starting, admission, identity, attendees, recording only with its own consent, captures, mandatory report (with an optional Assistant draft) and attendance proof. Video through the video service chosen in Settings."
        },
        {
            "name": "Mapa de cirurgias",
            "description": "Lifecycle pre-booked → reserved → validated → confirmed (only with a valid surgical consent) → in progress → completed, team with conflict checks, fitness, indicators, weekly roster, theatre occupancy and pre-operative checklist."
        },
        {
            "name": "Painel cirúrgico",
            "description": "Surgery day: phases with timer and pauses, graft counting by FU type (1, 2, 3, 4+), batches with time out of body, sampled transection, nursing and anaesthesia with lidocaine mg/kg alert, per-phase checklists, discharge and definitive closing."
        },
        {
            "name": "Avisos no telemóvel",
            "description": "Registration of devices with the app that receive system notifications, per-category preferences and test notification. Notifications never carry clinical or personal content: only the clinic name, a generic sentence and the screen link (in the data, invisible on the lock screen). Sending is done by the scheduler from the core notifications."
        },
        {
            "name": "Ficha do paciente",
            "description": "Single patient record: header, clinical alerts, episodes, journey and sections from every module (only those the caller may see), summary by the clinic's AI assistant, duplicates, assisted merge, medication alerts before prescribing and record import. Clinical data is only returned to callers with ficha.clinica and the patient in scope; administration, sales and reception never receive clinical content (data protection ceilings). The generic resources /r/pacientes, /r/episodios, /r/episodios_equipa and /r/pacientes_alertas are documented under «Resources»."
        },
        {
            "name": "Consultas",
            "description": "Clinical consultation: creation with the history pre-filled from the last signed consultation, draft saving with live eligibility, signing with a SHA-256 fingerprint (afterwards only addenda), feasibility validation, scribe and pre-analysis by the clinic's AI assistant (always proposals), completeness before surgery and human decision on proposals. The generic resource /r/consultas lists and filters consultations."
        },
        {
            "name": "Validação médica",
            "description": "Single queue of items awaiting a professional decision: pending AI proposals, form responses awaiting validation, website pre-assessments, reported alerts and consultations awaiting signature — only for patients in clinical scope. Includes the AI performance review (agreement rate)."
        },
        {
            "name": "Formulários",
            "description": "Clinical form builder (steps, sections, 12 question types, conditional rules, scoring with bands, alarms and alerts), versions, template library, translation by the clinic's AI assistant, completion by the team or by integrations and fill-in requests by link. The generic resources /r/formularios and /r/formularios_respostas are documented under «Resources»."
        },
        {
            "name": "Formulários por ligação",
            "description": "Public completion by link, without a session: the link token identifies the request, the patient and the clinic. Used by the app in patient mode and by anyone embedding the form elsewhere. Responses always await validation; the patient only gets a receipt confirmation."
        },
        {
            "name": "Propostas",
            "description": "Proposals from the approved plan (M3) or manual: options, extras, lines, discount with approval above the profile limit, instalments, currency with fixed exchange rate, seal (SHA-256), sending with a personal link, acceptance with proof, decline, revision, reactivation and cancellation. Margins and internal costs only for those who see clinic-wide figures."
        },
        {
            "name": "Caixa",
            "description": "Daily till: opening with an initial balance, in-person payments, cash-ins and withdrawals, closing with a count per method and difference."
        },
        {
            "name": "Pagamentos",
            "description": "Patient payment plan, MB WAY requests, Multibanco references and payment links (provider and credentials per clinic), manual receipts, cancellation, refund and tax documents issued by the clinic's certified invoicing software. Card data is never handled."
        },
        {
            "name": "Comissões e honorários",
            "description": "Sales team commissions (never for doctors) and doctors' fees per own act; those who do not manage figures see only their own."
        },
        {
            "name": "Stock",
            "description": "Consumption per surgery (stock-outs with batch, linked to the surgery and patient) and minimum stock and expiry alerts."
        },
        {
            "name": "Portal — propostas e pagamentos",
            "description": "The authenticated patient views their sent proposals, accepts or declines, sees payments and pays by MB WAY, Multibanco or link."
        },
        {
            "name": "Proposta pública",
            "description": "Proposal page via personal link (64-character token; only its SHA-256 is stored). The clinic is the one that owns the proposal. No session; forms with CSRF, honeypot field and per-address rate limit."
        },
        {
            "name": "Avisos de fornecedores (comercial)",
            "description": "Payment notifications from the provider, from payment terminals (SumUp and Stripe) and document status from the invoicing software. The clinic is resolved from the record (reference, order or document) and validated with that clinic's key; payments only become paid after confirmation by the provider's API."
        },
        {
            "name": "Carteira",
            "description": "Patient wallet: credits, advances and prepayments, use of the balance in payments (no new invoice), refunds with a reason and reversals. Immutable entries in cents; the API returns euros plus the *_centimos pair."
        },
        {
            "name": "Terminais de pagamento",
            "description": "Charges on cloud terminals (SumUp Solo, Stripe Terminal): sending to the terminal, live status, cancellation and reconciliation with the till. The card is read on the terminal; nothing leaves outside production."
        },
        {
            "name": "Vales de oferta",
            "description": "Sale of vouchers with a unique code, expiry and balance, lookup by code and full or partial use in payments. Multi-purpose (invoice on use) or single-purpose (invoice on sale)."
        },
        {
            "name": "Contas pagadoras e convenções",
            "description": "Paying-account statements (sub-accounts with balances) and procedures split between a payer or agreement and the patient; the payer's share is invoiced to the account."
        },
        {
            "name": "Consentimentos",
            "description": "Consent collection per purpose (no pre-selected answers), privacy notice, information delivery and reflection period, patient and physician signatures, sending for signature at home, and proof of each consent. Records are immutable."
        },
        {
            "name": "Documentos",
            "description": "Issuing from approved templates with automatic fields, preview, sending for signature with a one-time code, on-screen or qualified signature, sharing in the portal, cancellation and public verification by the XXXX-XXXX code."
        },
        {
            "name": "Proteção de dados",
            "description": "Data protection officer dashboard (data-subject, complaint and incident deadlines, anomalous access, processors, processing register, training, ERS register, retention), quarterly access review, per-patient «who accessed», complaint export for the ERS and data-subject export."
        },
        {
            "name": "Funil e leads",
            "description": "Lead capture: lead creation from forms and ads, stage funnel with target times, decision, next action, distribution, duplicates, merge and conversion to patient."
        },
        {
            "name": "Caixa de entrada",
            "description": "Multichannel service (portal, WhatsApp, Instagram, Messenger, email, SMS, website chat) in a single inbox linked to the record, with queues, departments, internal notes, translation and AI suggestions."
        },
        {
            "name": "Marcador e chamadas",
            "description": "Call lists with scripts, blocking of commercial calls without consent, click to call and statistics."
        },
        {
            "name": "Agente de IA",
            "description": "Requests handled by the voice agent and written assistants, hand-over to the team, alarm signs, corrections and sample review."
        },
        {
            "name": "Campanhas de marketing",
            "description": "Block-based campaign editor, count of who can receive, mandatory clinical approval, scheduling, test and statistics."
        },
        {
            "name": "Resultados de marketing",
            "description": "Ad costs, cost per lead, consultation and surgery, and conversions for platforms."
        },
        {
            "name": "Avisos de fornecedores (CRM)",
            "description": "Addresses called by providers (WhatsApp/Meta, PBX, voice agent). Each clinic is identified by its own number, account or secret; never by default."
        },
        {
            "name": "Chat do site e subscrições",
            "description": "Public endpoints: website chat, unsubscribe and subscription confirmation, and click tracking."
        },
        {
            "name": "Painel",
            "description": "Role-based dashboard: cards from the modules visible to the person, ordered by role and preferences, in the single block format."
        },
        {
            "name": "Tarefas",
            "description": "Team tasks: mine, team, board by state, checklists, complete and reopen. Also for integrations (scope equipa.tarefas)."
        },
        {
            "name": "Chat interno",
            "description": "Direct, group, department, patient and surgery channels; mentions, attachments, read receipts and tasks from messages. Team only."
        },
        {
            "name": "Comunicados",
            "description": "Internal notices with read confirmation and who has not read yet."
        },
        {
            "name": "Indicadores",
            "description": "Four groups (financial, sales, operations, service) with previous-period comparison, charts and CSV export."
        },
        {
            "name": "Exportação",
            "description": "Full clinic data export and read tokens for analytics tools."
        },
        {
            "name": "Reuniões",
            "description": "Internal meetings recorded with notice and consent from everyone present: transcript by the clinic Assistant (local service first), summary and actions validated by a person. Team only."
        },
        {
            "name": "Academia",
            "description": "Internal team training: role-based paths, courses, lessons, tests and certificates. Team only."
        },
        {
            "name": "Visualizador 3D",
            "description": "Show a patient's 3D model inside your website, for a short time, without personal data.\n\n1. In the integration credentials, request scope «ficha.captura:editar» (clinical module: requires the justification approved by the clinic's clinical director) and register your site ORIGINS (https://…).\n2. `POST /modelos3d/{id}/incorporacao` returns `url` and `codigo_incorporacao` (iframe).\n3. Paste the iframe in a page of one of the authorised origins: the response sends `Content-Security-Policy: frame-ancestors` with those origins only, so browsers refuse the frame on other sites.\n\nThe link lasts 5 to 240 minutes (clinic default), shows a clean copy of the mesh (face removed by default), counts each view and is recorded in the patient's audit trail. Revoke with `DELETE /modelos3d/incorporacoes/{id}`."
        },
        {
            "name": "Licenças",
            "description": "Clinic licences: dashboard, list, new-clinic wizard and actions (superadministration)."
        },
        {
            "name": "A minha licença",
            "description": "Licence of the current clinic (clinic administration) and light state for banners."
        },
        {
            "name": "Superadministradores",
            "description": "Accounts with access to the platform areas."
        },
        {
            "name": "Clínica pública",
            "description": "Clinic choice in the app (patient mode) by code; no authentication."
        },
        {
            "name": "Ambiente",
            "description": "Which environment the server is in. Outside production nothing leaves the server (email, SMS, WhatsApp, webhooks, payments, invoicing, external assistant, backups to the external destination) without authorisation in the server .env; the app and the web show the «Test environment» banner. Every API response outside production carries X-AX-Ambiente."
        },
        {
            "name": "Operação da plataforma",
            "description": "Encrypted backups (daily, weekly, monthly), integrity checks, immutable external destination, restore tests in a separate schema, vulnerabilities, penetration tests and continuity exercises, hosting and subprocessors. Long actions are queued (202) and the scheduler runs them within minutes. Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators)."
        },
        {
            "name": "Parceiros",
            "description": "Partner portal: doctors and clinics referring patients. Own account with email verification and clinic approval. Partners see only their referrals and the status; clinical information (dates, procedure and milestones) only with the patient's express authorisation recorded by the clinic. Referral rewards only for partners who are not doctors.\n\nAuthentication: `POST /parceiros/auth/entrar` returns `token`; send it in the `X-AX-Parceiro` header (or `Authorization: Bearer axp_…`). 5 consecutive failures lock the account for 15 minutes."
        },
        {
            "name": "Planos cirúrgicos",
            "description": "Surgical plan with the server-side calculation engine: need per zone, donor capacity, sessions, balance, scenarios, versions, fingerprinted approval, simulation and proposal."
        },
        {
            "name": "Motor de cálculo",
            "description": "Engine parameter versions (section 5 table of the analysis), approved only by each clinic's clinical board."
        },
        {
            "name": "Galeria clínica",
            "description": "Captures per milestone, photos with quality scoring, previous-photo overlay, comparison, review of patient uploads, sharing, face blurring and 3D models."
        },
        {
            "name": "Tricoscopia",
            "description": "Trichoscopy fields with server-side densities, per-subzone averages and transfer to the plan."
        },
        {
            "name": "Acompanhamento",
            "description": "Post-operative milestones (d1 to m18), board, detail with closed loop, NPS, photo requests and recovery tasks."
        },
        {
            "name": "Análise e plano",
            "description": "Drawings on photos, face protection and export, trichoscopy image counting, trichogram, hair mass and same point, future loss, expectations, facial proportions, actual surgery, day 0 areas, implanted per zone and parameter tuning."
        },
        {
            "name": "Portal — início",
            "description": "Patient portal summary and updates."
        },
        {
            "name": "Portal — plano",
            "description": "Approved plan, simulation with notice, 3D model and proposals."
        },
        {
            "name": "Portal — marcações",
            "description": "Book, reschedule, cancel, confirm and video consultation."
        },
        {
            "name": "Portal — documentos",
            "description": "Shared documents, signatures, forms and uploads."
        },
        {
            "name": "Portal — autorizações",
            "description": "Consents per purpose, reflection and revocation."
        },
        {
            "name": "Portal — fotografias",
            "description": "Guided upload with light and focus check."
        },
        {
            "name": "Portal — mensagens",
            "description": "Secure messages with the team."
        },
        {
            "name": "Portal — pagamentos",
            "description": "Balance, invoices and MB WAY/Multibanco/link payments."
        },
        {
            "name": "Portal — recuperação",
            "description": "Post-operative milestones and instructions per stage."
        },
        {
            "name": "Portal — acessos",
            "description": "Who accessed the patient's data."
        },
        {
            "name": "Portal — os meus dados",
            "description": "Contacts, allergies, preferences, data subject rights and account."
        },
        {
            "name": "Portal · Cuidados por fase",
            "description": "Care videos and articles approved by the clinical director, available by day after surgery."
        },
        {
            "name": "Escudo de entrada",
            "description": "Protection of every sign-in (team and portal): device verification by work per attempt (find n such that SHA-256(\"salt:n\") starts with «bits» zero bits), per-account wait, traps, origin blocking and trusted device. Bodies of POST /auth/entrar, /portal/auth/codigo, /portal/auth/entrar and /portal/auth/registar accept escudo_desafio, escudo_solucao and dispositivo_confiavel; responses 428 CHALLENGE_REQUIRED {motivo, desafio}, 429 ACCOUNT_COOLDOWN {espera} (+ Retry-After), 403 BLOCKED and 401 identical to wrong credentials for automated attempts. Tokens include dispositivo_confiavel (store securely and send on later sign-ins)."
        },
        {
            "name": "Atividade",
            "description": "Full activity log of the clinic: who signed in, which page or screen they opened, which record or patient they viewed, what they created, changed, deleted or exported. Never clinical content."
        },
        {
            "name": "Segurança da plataforma",
            "description": "Reserved to platform management (403 for everyone else, including clinic administrators). Global infrastructure tables."
        },
        {
            "name": "Apresentação do AnagenSys",
            "description": "Public product page and demo requests (no session)."
        },
        {
            "name": "Pré-avaliação online",
            "description": "Online assessment form, photos and submission (no session)."
        },
        {
            "name": "Site — CMS",
            "description": "The clinic website's pages, blocks, images, publishing and versions."
        },
        {
            "name": "Site — analytics",
            "description": "Anonymous statistics and cookie decisions."
        },
        {
            "name": "Site — incorporação",
            "description": "Assessment embedded in the clinic's authorised websites."
        },
        {
            "name": "Site — pré-avaliações",
            "description": "Medical review and reply to online assessments."
        },
        {
            "name": "Plataforma — Apresentação",
            "description": "AnagenSys presentation content and demo requests (product management)."
        },
        {
            "name": "Recursos",
            "description": "Generic resources: one definition drives list, detail, create, update, (soft) delete, actions and options in the web app, the mobile app and this API."
        },
        {
            "name": "Recurso: Certificates",
            "description": "Certificates — module «equipa.chat»."
        },
        {
            "name": "Recurso: Academy courses",
            "description": "Academy courses — module «equipa.chat»."
        },
        {
            "name": "Recurso: Lessons",
            "description": "Lessons — module «equipa.chat»."
        },
        {
            "name": "Recurso: Training paths",
            "description": "Training paths — module «equipa.chat»."
        },
        {
            "name": "Recurso: Test questions",
            "description": "Test questions — module «equipa.chat»."
        },
        {
            "name": "Recurso: Emergency access",
            "description": "Emergency access — module «admin.auditoria»."
        },
        {
            "name": "Recurso: Agent requests",
            "description": "Agent requests — module «crm.agente»."
        },
        {
            "name": "Recurso: Test conversations",
            "description": "Test conversations — module «crm.agente»."
        },
        {
            "name": "Recurso: Access alerts",
            "description": "Access alerts — module «admin.auditoria»."
        },
        {
            "name": "Recurso: Integration clients",
            "description": "Integration clients — module «admin.definicoes»."
        },
        {
            "name": "Recurso: Items",
            "description": "Items — module «stock»."
        },
        {
            "name": "Recurso: Supplier prices",
            "description": "Supplier prices — module «stock»."
        },
        {
            "name": "Recurso: Record of processing activities",
            "description": "Record of processing activities — module «conformidade»."
        },
        {
            "name": "Recurso: Absences and holidays",
            "description": "Absences and holidays — module «agenda»."
        },
        {
            "name": "Recurso: Notices shown",
            "description": "Notices shown — module «conformidade»."
        },
        {
            "name": "Recurso: Privacy notices",
            "description": "Privacy notices — module «conformidade»."
        },
        {
            "name": "Recurso: Knowledge base",
            "description": "Knowledge base — module «crm.agente»."
        },
        {
            "name": "Recurso: Tills",
            "description": "Tills — module «financeiro.pagamentos»."
        },
        {
            "name": "Recurso: Campaigns",
            "description": "Campaigns — module «marketing»."
        },
        {
            "name": "Recurso: Call lists",
            "description": "Call lists — module «crm.telefonia»."
        },
        {
            "name": "Recurso: Captures",
            "description": "Captures — module «ficha.captura»; clinical reads are audited."
        },
        {
            "name": "Recurso: Published cases",
            "description": "Published cases — module «site.cms»."
        },
        {
            "name": "Recurso: Calls",
            "description": "Calls — module «crm.telefonia»."
        },
        {
            "name": "Recurso: Safety checklists",
            "description": "Safety checklists — module «bloco.registo»."
        },
        {
            "name": "Recurso: Surgeries",
            "description": "Surgeries — module «bloco.mapa»."
        },
        {
            "name": "Recurso: Clinics",
            "description": "Clinics — module «admin.definicoes»."
        },
        {
            "name": "Recurso: Website blocks",
            "description": "Website blocks — module «site.cms»."
        },
        {
            "name": "Recurso: Website pages",
            "description": "Website pages — module «site.cms»."
        },
        {
            "name": "Recurso: Discount codes",
            "description": "Discount codes — module «comercial.descontos»."
        },
        {
            "name": "Recurso: Commissions",
            "description": "Commissions — module «financeiro.valores»."
        },
        {
            "name": "Recurso: Commission rules",
            "description": "Commission rules — module «financeiro.valores»."
        },
        {
            "name": "Recurso: Complications",
            "description": "Complications — module «ficha.clinica»; clinical reads are audited."
        },
        {
            "name": "Recurso: Announcements",
            "description": "Announcements — module «equipa.chat»."
        },
        {
            "name": "Recurso: Consent templates",
            "description": "Consent templates — module «documentos»."
        },
        {
            "name": "Recurso: Consent register",
            "description": "Consent register — module «ficha.consentimentos»."
        },
        {
            "name": "Recurso: Retention periods",
            "description": "Retention periods — module «conformidade»."
        },
        {
            "name": "Recurso: Consultations",
            "description": "Consultations — module «ficha.clinica»; clinical reads are audited."
        },
        {
            "name": "Recurso: Paying accounts",
            "description": "Paying accounts — module «financeiro.pagamentos»."
        },
        {
            "name": "Recurso: Sub-accounts",
            "description": "Sub-accounts — module «financeiro.pagamentos»."
        },
        {
            "name": "Recurso: Agreements",
            "description": "Agreements — module «financeiro.pagamentos»."
        },
        {
            "name": "Recurso: Agreement procedures",
            "description": "Agreement procedures — module «financeiro.pagamentos»."
        },
        {
            "name": "Recurso: Conversations",
            "description": "Conversations — module «crm.atendimento»."
        },
        {
            "name": "Recurso: Care by stage",
            "description": "Care by stage — module «acompanhamento»."
        },
        {
            "name": "Recurso: Ad costs",
            "description": "Ad costs — module «marketing»."
        },
        {
            "name": "Recurso: Special dates",
            "description": "Special dates — module «marketing»."
        },
        {
            "name": "Recurso: Delegations",
            "description": "Delegations — module «admin.utilizadores»."
        },
        {
            "name": "Recurso: Support diagnoses",
            "description": "Support diagnoses — module «clinico.parametros»."
        },
        {
            "name": "Recurso: Document templates",
            "description": "Document templates — module «documentos»."
        },
        {
            "name": "Recurso: Issued documents",
            "description": "Issued documents — module «documentos»."
        },
        {
            "name": "Recurso: Tax documents",
            "description": "Tax documents — module «financeiro.pagamentos»."
        },
        {
            "name": "Recurso: Orders",
            "description": "Orders — module «stock»."
        },
        {
            "name": "Recurso: Episodes",
            "description": "Episodes — module «ficha.clinica»."
        },
        {
            "name": "Recurso: Episode teams",
            "description": "Episode teams — module «ficha.clinica»."
        },
        {
            "name": "Recurso: Equipment",
            "description": "Equipment — module «conformidade»."
        },
        {
            "name": "Recurso: Maintenance and records",
            "description": "Maintenance and records — module «conformidade»."
        },
        {
            "name": "Recurso: Teams",
            "description": "Teams — module «admin.utilizadores»."
        },
        {
            "name": "Recurso: Public holidays",
            "description": "Public holidays — module «agenda»."
        },
        {
            "name": "Recurso: Team training",
            "description": "Team training — module «conformidade»."
        },
        {
            "name": "Recurso: Forms",
            "description": "Forms — module «ficha.clinica»."
        },
        {
            "name": "Recurso: Form responses",
            "description": "Form responses — module «ficha.clinica»; clinical reads are audited."
        },
        {
            "name": "Recurso: Photographs",
            "description": "Photographs — module «ficha.fotografias»; clinical reads are audited."
        },
        {
            "name": "Recurso: Pipeline stages",
            "description": "Pipeline stages — module «crm.leads»."
        },
        {
            "name": "Recurso: Market funnels",
            "description": "Market funnels — module «crm.leads»."
        },
        {
            "name": "Recurso: Call scripts",
            "description": "Call scripts — module «crm.telefonia»."
        },
        {
            "name": "Recurso: Fees",
            "description": "Fees — module «financeiro.valores»."
        },
        {
            "name": "Recurso: Working hours",
            "description": "Working hours — module «agenda»."
        },
        {
            "name": "Recurso: AI requests",
            "description": "AI requests — module «admin.definicoes»."
        },
        {
            "name": "Recurso: AI proposals",
            "description": "AI proposals — module «ficha.clinica»; clinical reads are audited."
        },
        {
            "name": "Recurso: Image library",
            "description": "Image library — module «marketing»."
        },
        {
            "name": "Recurso: Imports",
            "description": "Imports — module «ficha.identificacao»."
        },
        {
            "name": "Recurso: Security incidents",
            "description": "Security incidents — module «conformidade»."
        },
        {
            "name": "Recurso: Itineraries",
            "description": "Itineraries — module «agenda»."
        },
        {
            "name": "Recurso: Leads",
            "description": "Leads — module «crm.leads»."
        },
        {
            "name": "Recurso: Waiting list",
            "description": "Waiting list — module «agenda»."
        },
        {
            "name": "Recurso: Locations",
            "description": "Locations — module «admin.definicoes»."
        },
        {
            "name": "Recurso: Appointment types",
            "description": "Appointment types — module «agenda»."
        },
        {
            "name": "Recurso: Appointments",
            "description": "Appointments — module «agenda»."
        },
        {
            "name": "Recurso: Follow-up milestones",
            "description": "Follow-up milestones — module «acompanhamento»; clinical reads are audited."
        },
        {
            "name": "Recurso: 3D models",
            "description": "3D models — module «ficha.captura»; clinical reads are audited."
        },
        {
            "name": "Recurso: Engine versions",
            "description": "Engine versions — module «clinico.parametros»."
        },
        {
            "name": "Recurso: Sales goals",
            "description": "Sales goals — module «crm.leads»."
        },
        {
            "name": "Recurso: Patients",
            "description": "Patients — module «ficha.identificacao»."
        },
        {
            "name": "Recurso: Clinical alerts",
            "description": "Clinical alerts — module «ficha.clinica»; clinical reads are audited."
        },
        {
            "name": "Recurso: Payments",
            "description": "Payments — module «financeiro.pagamentos»."
        },
        {
            "name": "Recurso: Partners",
            "description": "Partners — module «crm.leads»."
        },
        {
            "name": "Recurso: Partner referrals",
            "description": "Partner referrals — module «crm.leads»."
        },
        {
            "name": "Recurso: Data subject requests",
            "description": "Data subject requests — module «conformidade»."
        },
        {
            "name": "Recurso: Profiles",
            "description": "Profiles — module «admin.utilizadores»."
        },
        {
            "name": "Recurso: Surgical plans",
            "description": "Surgical plans — module «ficha.plano»; clinical reads are audited."
        },
        {
            "name": "Recurso: Portal accounts",
            "description": "Portal accounts — module «ficha.identificacao»."
        },
        {
            "name": "Recurso: Portal requests",
            "description": "Portal requests — module «ficha.identificacao»."
        },
        {
            "name": "Recurso: Online assessments",
            "description": "Online assessments — module «crm.atendimento»."
        },
        {
            "name": "Recurso: Procedures",
            "description": "Procedures — module «financeiro.pagamentos»."
        },
        {
            "name": "Recurso: Proposals",
            "description": "Proposals — module «comercial.propostas»."
        },
        {
            "name": "Recurso: Photo protocols",
            "description": "Photo protocols — module «ficha.captura»."
        },
        {
            "name": "Recurso: Ad audiences",
            "description": "Ad audiences — module «marketing»."
        },
        {
            "name": "Recurso: Complaints, compliments and suggestions",
            "description": "Complaints, compliments and suggestions — module «conformidade»."
        },
        {
            "name": "Recurso: Rooms, equipment and interpreters",
            "description": "Rooms, equipment and interpreters — module «agenda»."
        },
        {
            "name": "Recurso: Eligibility rules",
            "description": "Eligibility rules — module «clinico.parametros»."
        },
        {
            "name": "Recurso: Scheduled reports",
            "description": "Scheduled reports — module «admin.definicoes»."
        },
        {
            "name": "Recurso: Quick replies",
            "description": "Quick replies — module «crm.atendimento»."
        },
        {
            "name": "Recurso: Meetings",
            "description": "Meetings — module «equipa.chat»."
        },
        {
            "name": "Recurso: Access reviews",
            "description": "Access reviews — module «admin.utilizadores»."
        },
        {
            "name": "Recurso: Segments",
            "description": "Segments — module «marketing»."
        },
        {
            "name": "Recurso: Sequences",
            "description": "Sequences — module «crm.leads»."
        },
        {
            "name": "Recurso: Stock movements",
            "description": "Stock movements — module «stock»."
        },
        {
            "name": "Recurso: Processors",
            "description": "Processors — module «conformidade»."
        },
        {
            "name": "Recurso: Contact opt-outs",
            "description": "Contact opt-outs — module «conformidade»."
        },
        {
            "name": "Recurso: Price lists",
            "description": "Price lists — module «financeiro.pagamentos»."
        },
        {
            "name": "Recurso: Tasks",
            "description": "Tasks — module «equipa.tarefas»."
        },
        {
            "name": "Recurso: Teleconsultations",
            "description": "Teleconsultations — module «teleconsulta»; clinical reads are audited."
        },
        {
            "name": "Recurso: Extensions",
            "description": "Extensions — module «crm.telefonia»."
        },
        {
            "name": "Recurso: Clinic numbers",
            "description": "Clinic numbers — module «crm.telefonia»."
        },
        {
            "name": "Recurso: Payment terminals",
            "description": "Payment terminals — module «financeiro.pagamentos»."
        },
        {
            "name": "Recurso: Complementary treatments",
            "description": "Complementary treatments — module «acompanhamento»; clinical reads are audited."
        },
        {
            "name": "Recurso: Trichoscopy fields",
            "description": "Trichoscopy fields — module «ficha.captura»; clinical reads are audited."
        },
        {
            "name": "Recurso: Users",
            "description": "Users — module «admin.utilizadores»."
        },
        {
            "name": "Recurso: Gift vouchers",
            "description": "Gift vouchers — module «financeiro.pagamentos»."
        },
        {
            "name": "Recurso: Recorded messages",
            "description": "Recorded messages — module «crm.telefonia»."
        },
        {
            "name": "Recurso: Voice menus",
            "description": "Voice menus — module «crm.telefonia»."
        },
        {
            "name": "Recurso: Webhooks",
            "description": "Webhooks — module «admin.definicoes»."
        },
        {
            "name": "Recurso: Webhook deliveries",
            "description": "Webhook deliveries — module «admin.definicoes»."
        },
        {
            "name": "Recurso: WhatsApp lines",
            "description": "WhatsApp lines — module «admin.definicoes»."
        }
    ],
    "paths": {
        "/academia": {
            "get": {
                "tags": [
                    "Academia"
                ],
                "operationId": "painelAcademia",
                "summary": "My academy",
                "description": "Role paths (progress, deadline, overdue), courses published for the person, certificates and KPIs. «gerir» tells whether the person manages the academy.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "kpis": {
                                                    "type": "object"
                                                },
                                                "percursos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "cursos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "certificados": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "categorias": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "gerir": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "kpis": {
                                            "cursos": 6,
                                            "concluidos": 2,
                                            "em_curso": 1,
                                            "certificados": 2,
                                            "em_atraso": 0
                                        },
                                        "percursos": [],
                                        "cursos": [],
                                        "certificados": [],
                                        "categorias": [],
                                        "gerir": false
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/academia/certificados/{codigo}": {
            "get": {
                "tags": [
                    "Academia"
                ],
                "operationId": "obterCertificadoAcademia",
                "summary": "Certificate (with verification)",
                "description": "Own certificate or, for managers, anyone in the clinic. «integro» confirms the certificate signature.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "codigo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^AX-[A-F0-9]{4}-[A-F0-9]{4}$"
                        },
                        "example": "AX-1A2B-3C4D"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "codigo": {
                                                    "type": "string"
                                                },
                                                "pessoa": {
                                                    "type": "string"
                                                },
                                                "curso": {
                                                    "type": "string"
                                                },
                                                "nota": {
                                                    "type": "integer"
                                                },
                                                "emitido_em": {
                                                    "type": "string"
                                                },
                                                "valido_ate": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "revogado": {
                                                    "type": "boolean"
                                                },
                                                "expirado": {
                                                    "type": "boolean"
                                                },
                                                "integro": {
                                                    "type": "boolean"
                                                },
                                                "valido": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/academia/cursos/{id}": {
            "get": {
                "tags": [
                    "Academia"
                ],
                "operationId": "obterCursoAcademia",
                "summary": "Course, lessons and test",
                "description": "Lessons with text, video and file (signed links valid 60 min) and the test WITHOUT the correct answers.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Course identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CursoAcademia"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/academia/cursos/{id}/licoes/{licao}/concluir": {
            "post": {
                "tags": [
                    "Academia"
                ],
                "operationId": "concluirLicaoAcademia",
                "summary": "Mark a lesson as done",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Course identifier"
                    },
                    {
                        "name": "licao",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Lesson identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CursoAcademia"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/academia/cursos/{id}/teste": {
            "post": {
                "tags": [
                    "Academia"
                ],
                "operationId": "entregarTesteAcademia",
                "summary": "Submit the test",
                "description": "Grades, records the attempt and, with the pass mark, issues the certificate. Returns per-question correction (correct options and explanation). 409 when required lessons are missing.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Course identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "respostas"
                                ],
                                "properties": {
                                    "respostas": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "array",
                                            "items": {
                                                "type": "integer"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "respostas": {
                                    "31": [
                                        1
                                    ],
                                    "32": [
                                        0,
                                        2
                                    ]
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "nota": {
                                                    "type": "integer"
                                                },
                                                "aprovado": {
                                                    "type": "boolean"
                                                },
                                                "acertos": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "nota_minima": {
                                                    "type": "integer"
                                                },
                                                "correcao": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "certificado": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ]
                                                },
                                                "curso": {
                                                    "$ref": "#/components/schemas/CursoAcademia"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "nota": 100,
                                        "aprovado": true,
                                        "acertos": 2,
                                        "total": 2,
                                        "nota_minima": 80,
                                        "correcao": [],
                                        "certificado": {
                                            "codigo": "AX-1A2B-3C4D"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/academia/equipa": {
            "get": {
                "tags": [
                    "Academia"
                ],
                "operationId": "equipaAcademia",
                "summary": "Team progress (managers)",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "pessoas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "nome": {
                                                                "type": "string"
                                                            },
                                                            "perfil": {
                                                                "type": "string"
                                                            },
                                                            "obrigatorios": {
                                                                "type": "integer"
                                                            },
                                                            "concluidos": {
                                                                "type": "integer"
                                                            },
                                                            "pct": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    }
                                                },
                                                "cursos_obrigatorios": {
                                                    "type": "integer"
                                                },
                                                "em_dia": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/acompanhamento/marcos/{id}": {
            "get": {
                "tags": [
                    "Acompanhamento"
                ],
                "operationId": "detalheMarco",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "ver",
                "summary": "Milestone detail",
                "description": "Photos vs day 0 (with ficha.fotografias), questionnaire, NPS, closed loop planned/projected/obtained per zone (with ficha.plano or ficha.captura), metrics over time (with ficha.captura) and treatments (prescription only with ficha.clinica).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/DetalheMarco"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "put": {
                "tags": [
                    "Acompanhamento"
                ],
                "operationId": "gravarMarco",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "summary": "Save NPS, measurements and links",
                "description": "densidade_obtida, densidades_zona and metricas require ficha.captura:edit; notes require ficha.clinica.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nps": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 10
                                    },
                                    "densidade_obtida": {
                                        "type": "number",
                                        "x-unidade": "UF/cm²"
                                    },
                                    "densidades_zona": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "number"
                                        },
                                        "x-unidade": "UF/cm²"
                                    },
                                    "metricas": {
                                        "type": "object",
                                        "properties": {
                                            "racio_terminal_vellus": {
                                                "type": "number"
                                            },
                                            "calibre_mm": {
                                                "type": "number"
                                            },
                                            "pct_terminais": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "notas": {
                                        "type": "string"
                                    },
                                    "data_prevista": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "captura_id": {
                                        "type": "integer"
                                    },
                                    "marcacao_id": {
                                        "type": "integer"
                                    },
                                    "resposta_id": {
                                        "type": "integer"
                                    }
                                }
                            },
                            "example": {
                                "nps": 9,
                                "densidades_zona": {
                                    "linha_frontal": 23.4,
                                    "coroa": 17.8
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/DetalheMarco"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/acompanhamento/marcos/{id}/estado": {
            "post": {
                "tags": [
                    "Acompanhamento"
                ],
                "operationId": "estadoMarco",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "summary": "Change the status (board)",
                "description": "«falhado» creates a recovery task for reception; «concluido» fires the marco.concluido webhook.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "pendente",
                                            "fotos_enviadas",
                                            "revisto",
                                            "concluido",
                                            "em_atraso",
                                            "falhado"
                                        ]
                                    },
                                    "ordem": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "estado"
                                ]
                            },
                            "example": {
                                "estado": "revisto",
                                "ordem": 0
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "estado": {
                                                    "type": "string"
                                                },
                                                "tarefa_id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/acompanhamento/marcos/{id}/pedir-fotos": {
            "post": {
                "tags": [
                    "Acompanhamento"
                ],
                "operationId": "pedirFotosMarco",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "summary": "Ask the patient for the milestone photos",
                "description": "Portal notification and service message (channel from Settings), in the patient's language and without clinical details.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "estado": {
                                                    "type": "string"
                                                },
                                                "enviado": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/acompanhamento/marcos/{id}/recuperacao": {
            "post": {
                "tags": [
                    "Acompanhamento"
                ],
                "operationId": "recuperacaoMarco",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "summary": "Recovery task for reception",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nota": {
                                        "type": "string",
                                        "maxLength": 500
                                    }
                                }
                            },
                            "example": {
                                "nota": "Sem resposta às mensagens do mês 2."
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "tarefa_id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "tarefa_id": 4410
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/acompanhamento/quadro": {
            "get": {
                "tags": [
                    "Acompanhamento"
                ],
                "operationId": "quadroAcompanhamento",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "ver",
                "summary": "Milestone board",
                "description": "Columns by status with cards (patient, milestone, due date, days, overdue, NPS, photos pending), KPIs. Completed/failed only from the last 60 days.",
                "parameters": [
                    {
                        "name": "marco",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "d1",
                                "s1",
                                "m1",
                                "m2",
                                "m6",
                                "m9",
                                "m12",
                                "m18"
                            ]
                        },
                        "description": "Milestone"
                    },
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient"
                    },
                    {
                        "name": "de",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "From"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "To"
                    },
                    {
                        "name": "so_atraso",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        },
                        "description": "Overdue only"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/QuadroMarcos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/agenda/calendarios": {
            "get": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6CalendariosEstado",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Professional external calendars",
                "description": "Google Calendar and Microsoft 365: whether enabled in the clinic and the person’s connection (status, masked account, preferences, last sync, counts). Tokens never leave the server.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "fornecedores": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "detalhe": {
                                                    "type": "string",
                                                    "enum": [
                                                        "tipo",
                                                        "ocupado"
                                                    ]
                                                },
                                                "janela_dias": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "fornecedores": [
                                            {
                                                "chave": "google",
                                                "rotulo": "Google Calendar",
                                                "configurado": true,
                                                "ligacao": {
                                                    "id": 3,
                                                    "fornecedor": "google",
                                                    "conta": "in••••@clinica.pt",
                                                    "estado": "ativa",
                                                    "estado_rotulo": "Ligado",
                                                    "subir_marcacoes": true,
                                                    "bloquear_agenda": true,
                                                    "sincronizado_em": "2026-11-03T09:40:00+00:00",
                                                    "ultimo_erro": null,
                                                    "ocupados_lidos": 7,
                                                    "marcacoes_enviadas": 21
                                                }
                                            },
                                            {
                                                "chave": "microsoft",
                                                "rotulo": "Microsoft 365",
                                                "configurado": false,
                                                "ligacao": null
                                            }
                                        ],
                                        "detalhe": "tipo",
                                        "janela_dias": 60
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/calendarios/sincronizar": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6CalendariosSincronizar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Sync now",
                "description": "Syncs the person’s connections both ways (the scheduler does it every 10 minutes).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "resultado": {
                                                    "type": "object"
                                                },
                                                "fornecedores": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/calendarios/{fornecedor}/desligar": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6CalendariosDesligar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "fornecedor",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "google",
                                "microsoft"
                            ]
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Disconnect the calendar",
                "description": "Deletes sent appointments in the external calendar (by default), revokes the authorisation when the provider allows it, deletes tokens and read blocks.",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "apagar_eventos": {
                                        "type": "boolean"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/calendarios/{fornecedor}/ligar": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6CalendariosLigar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "fornecedor",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "google",
                                "microsoft"
                            ]
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Start the connection (OAuth)",
                "description": "Returns the provider authorisation URL (OAuth 2.0 with PKCE, single-use state valid for 10 minutes). The app opens it in the system browser; the provider returns to /agenda/calendarios/retorno/{fornecedor}, which stores the encrypted tokens and runs the first sync.",
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "url": {
                                                    "type": "string",
                                                    "format": "uri"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=…&state=…&code_challenge=…"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/calendarios/{fornecedor}/preferencias": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6CalendariosPreferencias",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "fornecedor",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "google",
                                "microsoft"
                            ]
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Connection preferences",
                "description": "«subir_marcacoes»: send appointments (no patient data); «bloquear_agenda»: external commitments remove slots and raise conflicts.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "subir_marcacoes": {
                                        "type": "boolean"
                                    },
                                    "bloquear_agenda": {
                                        "type": "boolean"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/configuracao": {
            "get": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6AgendaConfiguracao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Calendar configuration",
                "description": "Active appointment types (duration, colour, margins, teleconsultation, surgery, mandatory room, deposit, online booking), calendar professionals (with working hours or a clinical profile), active staff, rooms, equipment, interpreters, calendar start and end hours (Settings › Calendar), statuses with label and tone, and whether the caller can edit. No side effects.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6ConfiguracaoAgenda"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "tipos": [
                                            {
                                                "id": 3,
                                                "chave": "avaliacao",
                                                "nome": "Consulta de avaliação",
                                                "duracao_min": 45,
                                                "cor": "#2F6F62",
                                                "teleconsulta": false,
                                                "cirurgia": false,
                                                "sala_obrigatoria": true,
                                                "exige_sinal": false,
                                                "margem_antes_min": 0,
                                                "margem_depois_min": 10,
                                                "online": true
                                            },
                                            {
                                                "id": 4,
                                                "chave": "teleconsulta",
                                                "nome": "Teleconsulta",
                                                "duracao_min": 30,
                                                "cor": "#3A7BC0",
                                                "teleconsulta": true,
                                                "cirurgia": false,
                                                "sala_obrigatoria": false,
                                                "exige_sinal": false,
                                                "margem_antes_min": 0,
                                                "margem_depois_min": 0,
                                                "online": true
                                            },
                                            {
                                                "id": 9,
                                                "chave": "cirurgia",
                                                "nome": "Cirurgia",
                                                "duracao_min": 360,
                                                "cor": "#8C2F39",
                                                "teleconsulta": false,
                                                "cirurgia": true,
                                                "sala_obrigatoria": true,
                                                "exige_sinal": true,
                                                "margem_antes_min": 30,
                                                "margem_depois_min": 45,
                                                "online": false
                                            }
                                        ],
                                        "profissionais": [
                                            {
                                                "id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "perfil": "medico",
                                                "departamento": "medico"
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "perfil": "medico",
                                                "departamento": "medico"
                                            },
                                            {
                                                "id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "perfil": "tecnico",
                                                "departamento": "tecnico"
                                            }
                                        ],
                                        "salas": [
                                            {
                                                "id": 12,
                                                "nome": "Gabinete 2",
                                                "cor": "#5B6770",
                                                "idioma": null,
                                                "bloco": false,
                                                "capacidade": 1
                                            },
                                            {
                                                "id": 5,
                                                "nome": "Bloco 1",
                                                "cor": "#8C2F39",
                                                "idioma": null,
                                                "bloco": true,
                                                "capacidade": 1
                                            }
                                        ],
                                        "equipamentos": [
                                            {
                                                "id": 21,
                                                "nome": "Tricoscópio digital",
                                                "cor": null,
                                                "idioma": null,
                                                "bloco": false,
                                                "capacidade": 1
                                            }
                                        ],
                                        "interpretes": [
                                            {
                                                "id": 30,
                                                "nome": "Intérprete de francês",
                                                "cor": null,
                                                "idioma": "fr",
                                                "bloco": false,
                                                "capacidade": 1
                                            }
                                        ],
                                        "hora_inicio": 8,
                                        "hora_fim": 20,
                                        "estados": [
                                            {
                                                "valor": "pedido",
                                                "rotulo": "Pedido",
                                                "tom": "ouro"
                                            },
                                            {
                                                "valor": "marcada",
                                                "rotulo": "Por confirmar",
                                                "tom": "aviso"
                                            },
                                            {
                                                "valor": "confirmada",
                                                "rotulo": "Confirmada",
                                                "tom": "sucesso"
                                            }
                                        ],
                                        "pode_editar": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/disponibilidade": {
            "get": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6AgendaDisponibilidade",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Free slots for an appointment type",
                "description": "Computes on the server the slots between «de» and «ate» (maximum 31 days), optionally for one professional: working hours admitting the type, approved absences, holidays, existing appointments with margins, the type minimum notice (and at least 5 minutes) and a free room when the type requires a room or is a surgery. Step and maximum number of slots in Settings › Calendar (15 min and 300 by default). Sorted by time. No side effects.",
                "parameters": [
                    {
                        "name": "tipo_id",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Appointment type (required)."
                    },
                    {
                        "name": "de",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "First day (default today)."
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Last day (default today + 14 days)."
                    },
                    {
                        "name": "profissional_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Only slots of this professional."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M6Vaga"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "inicio": "2026-11-03T11:00:00+00:00",
                                            "fim": "2026-11-03T11:45:00+00:00",
                                            "profissional_id": 7,
                                            "profissional_nome": "Inês Valente",
                                            "sala_id": 12,
                                            "sala_nome": "Gabinete 2"
                                        },
                                        {
                                            "inicio": "2026-11-03T11:15:00+00:00",
                                            "fim": "2026-11-03T12:00:00+00:00",
                                            "profissional_id": 7,
                                            "profissional_nome": "Inês Valente",
                                            "sala_id": 12,
                                            "sala_nome": "Gabinete 2"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/eventos": {
            "get": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6AgendaEventos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Calendar events between two dates",
                "description": "Appointments within the caller scope (scope «own»: their appointments and those of their patients), type preparation and cleaning margins, approved absences and holidays. Without a status filter, cancelled and rescheduled ones are left out. Maximum range 62 days (default today → +7 days). In the API «url» is always null and dates carry an offset; holidays come with the date only. Up to 2000 appointments. meta.total counts every returned event.",
                "parameters": [
                    {
                        "name": "inicio",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Range start (YYYY-MM-DD or ISO 8601)."
                    },
                    {
                        "name": "fim",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Range end (exclusive)."
                    },
                    {
                        "name": "colunas",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "profissional",
                                "sala",
                                "equipamento"
                            ],
                            "default": "profissional"
                        },
                        "description": "What fills «recurso» on each event. With «equipamento», each appointment appears once per reserved equipment (id «eq<equipment>-<id>», the appointment in «marcacao_id», not editable). With «profissional», commitments from connected external calendars come as «externo» events (times only, no details)."
                    },
                    {
                        "name": "cor",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "tipo",
                                "profissional",
                                "estado"
                            ],
                            "default": "tipo"
                        },
                        "description": "Source of the event colour (no-shows are always red)."
                    },
                    {
                        "name": "f[profissional_id]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Filter by professional."
                    },
                    {
                        "name": "f[sala_id]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Filter by room."
                    },
                    {
                        "name": "f[tipo_id]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Filter by appointment type."
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pedido",
                                "marcada",
                                "confirmada",
                                "em_curso",
                                "concluida",
                                "faltou",
                                "cancelada",
                                "remarcada"
                            ]
                        },
                        "description": "Filter by status."
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Filter by patient."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M6Evento"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 8840,
                                            "titulo": "Rui Almeida",
                                            "subtitulo": "Consulta de avaliação · Gabinete 2 · Por confirmar",
                                            "inicio": "2026-11-03T10:00:00+00:00",
                                            "fim": "2026-11-03T10:45:00+00:00",
                                            "cor": "#2F6F62",
                                            "recurso": 7,
                                            "url": null,
                                            "editavel": true,
                                            "tipo": "marcacao",
                                            "estado": "marcada",
                                            "estado_rotulo": "Por confirmar",
                                            "tipo_id": 3,
                                            "tipo_nome": "Consulta de avaliação",
                                            "tipo_cor": "#2F6F62",
                                            "paciente_id": 1204,
                                            "profissional_id": 7,
                                            "profissional_nome": "Inês Valente",
                                            "profissional_cor": "#7A4E9C",
                                            "sala_id": 12,
                                            "sala_nome": "Gabinete 2",
                                            "teleconsulta": false,
                                            "cirurgia_id": null,
                                            "confirmada": false
                                        },
                                        {
                                            "id": "margem-8840-depois",
                                            "titulo": "Limpeza",
                                            "subtitulo": "Rui Almeida",
                                            "inicio": "2026-11-03T10:45:00+00:00",
                                            "fim": "2026-11-03T10:55:00+00:00",
                                            "cor": "var(--ax-linha-forte)",
                                            "recurso": 7,
                                            "editavel": false,
                                            "tipo": "margem",
                                            "marcacao_id": 8840
                                        },
                                        {
                                            "id": "ausencia-31",
                                            "titulo": "Férias — Marta Sousa",
                                            "inicio": "2026-11-03T00:00:00+00:00",
                                            "fim": "2026-11-07T23:59:00+00:00",
                                            "cor": "var(--ax-linha-forte)",
                                            "recurso": 15,
                                            "editavel": false,
                                            "tipo": "ausencia",
                                            "url": null,
                                            "diaInteiro": true
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/fluxo": {
            "get": {
                "tags": [
                    "Fluxo do dia"
                ],
                "operationId": "m6FluxoDoDia",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Day flow board",
                "description": "One card per appointment of the day (calendar scope) in its station column: to arrive, admission, preparation, extraction, implantation, recovery, exit. Includes time in the current station, delays (still to arrive 10 minutes after the time) and a summary with average minutes per station. Surgeries move station automatically with the surgical panel phases.",
                "parameters": [
                    {
                        "name": "data",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Day (default today)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Fluxo"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "data": "2026-11-03",
                                        "colunas": [
                                            {
                                                "chave": "por_chegar",
                                                "rotulo": "Por chegar",
                                                "cartoes": [
                                                    {
                                                        "id": 8840,
                                                        "nome": "Rui Almeida",
                                                        "nome_curto": "Rui A.",
                                                        "paciente_id": 1204,
                                                        "hora": "10:00",
                                                        "inicio": "2026-11-03T10:00:00+00:00",
                                                        "tipo_nome": "Consulta de avaliação",
                                                        "tipo_cor": "#2F6F62",
                                                        "cirurgia_id": null,
                                                        "profissional_nome": "Inês Valente",
                                                        "profissional_cor": "#7A4E9C",
                                                        "sala_nome": "Gabinete 2",
                                                        "estado": "confirmada",
                                                        "confirmada": true,
                                                        "posto_desde": null,
                                                        "atrasado": false,
                                                        "atraso_minutos": null
                                                    }
                                                ]
                                            },
                                            {
                                                "chave": "admissao",
                                                "rotulo": "Admissão",
                                                "cartoes": []
                                            },
                                            {
                                                "chave": "preparacao",
                                                "rotulo": "Preparação",
                                                "cartoes": []
                                            },
                                            {
                                                "chave": "extracao",
                                                "rotulo": "Extração",
                                                "cartoes": []
                                            },
                                            {
                                                "chave": "implantacao",
                                                "rotulo": "Implantação",
                                                "cartoes": []
                                            },
                                            {
                                                "chave": "recobro",
                                                "rotulo": "Recobro",
                                                "cartoes": []
                                            },
                                            {
                                                "chave": "saida",
                                                "rotulo": "Saída",
                                                "cartoes": []
                                            }
                                        ],
                                        "resumo": {
                                            "total": 14,
                                            "por_chegar": 6,
                                            "em_fluxo": 3,
                                            "saida": 5,
                                            "atrasados": 1,
                                            "medias_min": {
                                                "admissao": 9,
                                                "recobro": 25
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/fluxo/{id}/posto": {
            "post": {
                "tags": [
                    "Fluxo do dia"
                ],
                "operationId": "m6MudarPosto",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Appointment identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Change the station of an appointment",
                "description": "Closes the current station (stores the time) and opens the new one; checks in when not done yet. «saida» completes the appointment; the other stations set it in progress. «por_chegar» undoes a mistake: clears the station and check-in and returns to confirmed/booked. Refused on cancelled, rescheduled or no-show appointments (409 «estado_invalido»). Effects: history.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "posto": {
                                        "type": "string",
                                        "enum": [
                                            "por_chegar",
                                            "admissao",
                                            "preparacao",
                                            "extracao",
                                            "implantacao",
                                            "recobro",
                                            "saida"
                                        ]
                                    }
                                },
                                "required": [
                                    "posto"
                                ]
                            },
                            "example": {
                                "posto": "admissao"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "posto": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "admissao",
                                                        "preparacao",
                                                        "extracao",
                                                        "implantacao",
                                                        "recobro",
                                                        "saida",
                                                        null
                                                    ]
                                                },
                                                "posto_desde": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "estado": {
                                                    "type": "string",
                                                    "enum": [
                                                        "em_curso",
                                                        "concluida"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 8840,
                                        "posto": "admissao",
                                        "posto_desde": "2026-11-03T09:56:12+00:00",
                                        "estado": "em_curso"
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Não é possível neste estado."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/lista-espera": {
            "get": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6ListaEspera",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Active waiting list",
                "description": "Active or already contacted entries (up to 100), by priority (high, normal, low) and age. When a slot is released (cancellation or reschedule more than 1 h ahead), the first matching entry becomes «contactado» with the offered time and reception gets a task. Entries are managed through the generic waiting-list resource.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M6ListaEspera"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 41,
                                            "paciente_id": 1290,
                                            "lead_id": null,
                                            "nome": "Carla Neves",
                                            "tipo_id": 3,
                                            "tipo_nome": "Consulta de avaliação",
                                            "profissional_id": 7,
                                            "preferencias": "Manhãs, terças ou quintas",
                                            "prioridade": "alta",
                                            "estado": "contactado",
                                            "desde": "2026-10-20",
                                            "oferta_inicio": "2026-11-03T10:00:00+00:00"
                                        },
                                        {
                                            "id": 44,
                                            "paciente_id": null,
                                            "lead_id": 512,
                                            "nome": "João Pires",
                                            "tipo_id": 3,
                                            "tipo_nome": "Consulta de avaliação",
                                            "profissional_id": null,
                                            "preferencias": null,
                                            "prioridade": "normal",
                                            "estado": "ativa",
                                            "desde": "2026-10-24",
                                            "oferta_inicio": null
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/marcacoes": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6CriarMarcacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Create appointment",
                "description": "Validates the fields (allowlist) and checks conflicts on the server for the range widened by the type margins. Blocking (409 «conflito»): professional or participant already busy, room above capacity, equipment or interpreter booked, approved absence, minimum notice on bookings with origin portal/site/agent. Warnings (409 «conflito_aviso»): holiday, outside working hours, professional without working hours, past date — resend with \"forcar\": true to accept; accepted warnings come back in «avisos». Effects: appointment history, audit, timeline event on the patient/lead, notification to the professional (when not the creator), deposit request in the commercial module when the type requires it, teleconsultation created when the type is a teleconsultation, waiting-list entry set to «marcado» and the marcacao.criada webhook.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Patient. Required when there is no lead_id."
                                    },
                                    "lead_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Lead (sales contact without a patient record yet)."
                                    },
                                    "tipo_id": {
                                        "type": "integer",
                                        "description": "Active appointment type (GET /agenda/configuracao → tipos)."
                                    },
                                    "inicio": {
                                        "type": "string",
                                        "format": "date-time",
                                        "description": "Start (ISO 8601; without offset it is the clinic local time)."
                                    },
                                    "fim": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "End. Default: start + type duration. Maximum 16 h."
                                    },
                                    "profissional_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Responsible professional. Required except for surgery types."
                                    },
                                    "sala_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Room (resource of type «room»). Required when the type demands it."
                                    },
                                    "recursos": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        },
                                        "description": "Equipment and interpreters (ids of non-room resources)."
                                    },
                                    "participantes": {
                                        "type": "array",
                                        "items": {
                                            "oneOf": [
                                                {
                                                    "type": "integer"
                                                },
                                                {
                                                    "type": "object",
                                                    "required": [
                                                        "utilizador_id"
                                                    ],
                                                    "properties": {
                                                        "utilizador_id": {
                                                            "type": "integer"
                                                        },
                                                        "papel": {
                                                            "type": "string",
                                                            "pattern": "^[a-z_]{2,30}$",
                                                            "default": "assistente"
                                                        }
                                                    }
                                                }
                                            ]
                                        },
                                        "description": "Other team members (ids or {utilizador_id, papel})."
                                    },
                                    "origem": {
                                        "type": "string",
                                        "enum": [
                                            "equipa",
                                            "portal",
                                            "site",
                                            "agente",
                                            "telefone"
                                        ],
                                        "default": "equipa",
                                        "description": "Source channel. With portal, site or agent the type minimum notice applies and warnings become blocking."
                                    },
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "pedido",
                                            "marcada",
                                            "confirmada"
                                        ],
                                        "description": "Initial status. Default «marcada» («pedido» for online bookings of types requiring a deposit)."
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "cirurgia_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 2000,
                                        "description": "Administrative notes (never clinical)."
                                    },
                                    "lista_espera_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Waiting-list entry fulfilled by this appointment (becomes «marcado»)."
                                    },
                                    "remarcada_de": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "permitir_passado": {
                                        "type": "boolean",
                                        "description": "Record an appointment in the past without the «passado» warning."
                                    },
                                    "forcar": {
                                        "type": "boolean",
                                        "description": "Accept the warnings (conflito_aviso: holiday, outside working hours, no working hours, past date). Never overrides blocking conflicts."
                                    }
                                },
                                "required": [
                                    "tipo_id",
                                    "inicio"
                                ]
                            },
                            "example": {
                                "paciente_id": 1204,
                                "tipo_id": 3,
                                "inicio": "2026-11-03T10:00:00+00:00",
                                "profissional_id": 7,
                                "sala_id": 12,
                                "recursos": [
                                    21
                                ],
                                "participantes": [
                                    {
                                        "utilizador_id": 15,
                                        "papel": "assistente"
                                    }
                                ],
                                "origem": "equipa",
                                "episodio_id": 77,
                                "notas": "Pede para ser contactado depois das 18:00.",
                                "forcar": false
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "avisos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/M6Conflito"
                                                    },
                                                    "description": "Warnings accepted with «forcar»."
                                                },
                                                "marcacao": {
                                                    "$ref": "#/components/schemas/M6Marcacao"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 8840,
                                        "avisos": [],
                                        "marcacao": {
                                            "id": 8840,
                                            "estado": "marcada",
                                            "estado_rotulo": "Por confirmar",
                                            "estado_tom": "aviso",
                                            "origem": "equipa",
                                            "origem_rotulo": "Equipa",
                                            "inicio": "2026-11-03T10:00:00+00:00",
                                            "fim": "2026-11-03T10:45:00+00:00",
                                            "duracao_min": 45,
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "lead_id": null,
                                            "lead_nome": null,
                                            "episodio_id": 77,
                                            "cirurgia_id": null,
                                            "tipo_id": 3,
                                            "tipo_nome": "Consulta de avaliação",
                                            "tipo_cor": "#2F6F62",
                                            "teleconsulta": null,
                                            "profissional_id": 7,
                                            "profissional_nome": "Inês Valente",
                                            "profissional_cor": "#7A4E9C",
                                            "sala_id": 12,
                                            "sala_nome": "Gabinete 2",
                                            "recursos": [
                                                {
                                                    "id": 21,
                                                    "nome": "Tricoscópio digital",
                                                    "tipo": "equipamento"
                                                }
                                            ],
                                            "participantes": [
                                                {
                                                    "utilizador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "papel": "assistente",
                                                    "cor": "#C0743A"
                                                }
                                            ],
                                            "notas": "Pede para ser contactado depois das 18:00.",
                                            "confirmada_em": null,
                                            "confirmacao_canal": null,
                                            "lembrete_enviado_em": null,
                                            "checkin_em": null,
                                            "posto": null,
                                            "atraso_minutos": null,
                                            "motivo_cancelamento": null,
                                            "remarcada_de": null,
                                            "remarcacoes": [],
                                            "politica": "Cancelamentos com menos de 24 h de antecedência perdem o sinal.",
                                            "historico": [
                                                {
                                                    "acao": "criada",
                                                    "descricao": "Marcada (Equipa)",
                                                    "autor": "Ana Ribeiro",
                                                    "criado_em": "2026-10-28T09:12:44+00:00"
                                                }
                                            ],
                                            "acoes": [
                                                "confirmar",
                                                "remarcar",
                                                "cancelar",
                                                "lembrete"
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (conflito, conflito_aviso, estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "conflito": {
                                        "summary": "conflito",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito",
                                                "mensagem": "Há conflitos na agenda.",
                                                "campos": {
                                                    "profissional_id": "Inês Valente já tem uma marcação das 10:00–10:45.",
                                                    "sala_id": "Gabinete 2 está ocupada (a partir das 10:00)."
                                                }
                                            }
                                        }
                                    },
                                    "conflito_aviso": {
                                        "summary": "conflito_aviso",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito_aviso",
                                                "mensagem": "Há avisos na agenda. Confirme para continuar.",
                                                "campos": {
                                                    "inicio": "É feriado: Implantação da República."
                                                }
                                            }
                                        }
                                    },
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Esta marcação já não pode ser mudada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/marcacoes/verificar": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6VerificarMarcacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Check conflicts without saving",
                "description": "Same rules as creation, saving nothing (to show conflicts live in the form). Validation errors come as conflicts with codigo «validacao», blocking and with the field. «ignorar» excludes an existing appointment (the same one, when changing it). Patient and professional are not required here.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Patient. Required when there is no lead_id."
                                    },
                                    "lead_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Lead (sales contact without a patient record yet)."
                                    },
                                    "tipo_id": {
                                        "type": "integer",
                                        "description": "Active appointment type (GET /agenda/configuracao → tipos)."
                                    },
                                    "inicio": {
                                        "type": "string",
                                        "format": "date-time",
                                        "description": "Start (ISO 8601; without offset it is the clinic local time)."
                                    },
                                    "fim": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "End. Default: start + type duration. Maximum 16 h."
                                    },
                                    "profissional_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Responsible professional. Required except for surgery types."
                                    },
                                    "sala_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Room (resource of type «room»). Required when the type demands it."
                                    },
                                    "recursos": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        },
                                        "description": "Equipment and interpreters (ids of non-room resources)."
                                    },
                                    "participantes": {
                                        "type": "array",
                                        "items": {
                                            "oneOf": [
                                                {
                                                    "type": "integer"
                                                },
                                                {
                                                    "type": "object",
                                                    "required": [
                                                        "utilizador_id"
                                                    ],
                                                    "properties": {
                                                        "utilizador_id": {
                                                            "type": "integer"
                                                        },
                                                        "papel": {
                                                            "type": "string",
                                                            "pattern": "^[a-z_]{2,30}$",
                                                            "default": "assistente"
                                                        }
                                                    }
                                                }
                                            ]
                                        },
                                        "description": "Other team members (ids or {utilizador_id, papel})."
                                    },
                                    "origem": {
                                        "type": "string",
                                        "enum": [
                                            "equipa",
                                            "portal",
                                            "site",
                                            "agente",
                                            "telefone"
                                        ],
                                        "default": "equipa",
                                        "description": "Source channel. With portal, site or agent the type minimum notice applies and warnings become blocking."
                                    },
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "pedido",
                                            "marcada",
                                            "confirmada"
                                        ],
                                        "description": "Initial status. Default «marcada» («pedido» for online bookings of types requiring a deposit)."
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "cirurgia_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 2000,
                                        "description": "Administrative notes (never clinical)."
                                    },
                                    "lista_espera_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Waiting-list entry fulfilled by this appointment (becomes «marcado»)."
                                    },
                                    "remarcada_de": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "permitir_passado": {
                                        "type": "boolean",
                                        "description": "Record an appointment in the past without the «passado» warning."
                                    },
                                    "forcar": {
                                        "type": "boolean",
                                        "description": "Accept the warnings (conflito_aviso: holiday, outside working hours, no working hours, past date). Never overrides blocking conflicts."
                                    },
                                    "ignorar": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Appointment to ignore in the check."
                                    }
                                },
                                "required": [
                                    "tipo_id",
                                    "inicio"
                                ]
                            },
                            "example": {
                                "tipo_id": 3,
                                "inicio": "2026-11-03T10:00:00+00:00",
                                "profissional_id": 7,
                                "sala_id": 12,
                                "participantes": [
                                    15
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "conflitos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/M6Conflito"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "conflitos": [
                                            {
                                                "codigo": "pessoa_ocupada",
                                                "mensagem": "Inês Valente já tem uma marcação das 10:00–10:45.",
                                                "bloqueante": true,
                                                "campo": "profissional_id",
                                                "marcacao_id": 8812,
                                                "utilizador_id": 7
                                            },
                                            {
                                                "codigo": "fora_horario",
                                                "mensagem": "Fora do horário de Inês Valente.",
                                                "bloqueante": false,
                                                "campo": "inicio"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/marcacoes/{id}": {
            "get": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6ObterMarcacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Appointment detail",
                "description": "Names, type, resources, participants, linked teleconsultation, reschedule chain, type cancellation policy, history (50 rows) and the actions available for the status and the caller permission. No clinical content. Out of scope answers 404. The read is audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Appointment identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Marcacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 8840,
                                        "estado": "marcada",
                                        "estado_rotulo": "Por confirmar",
                                        "estado_tom": "aviso",
                                        "origem": "equipa",
                                        "origem_rotulo": "Equipa",
                                        "inicio": "2026-11-03T10:00:00+00:00",
                                        "fim": "2026-11-03T10:45:00+00:00",
                                        "duracao_min": 45,
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "lead_id": null,
                                        "lead_nome": null,
                                        "episodio_id": 77,
                                        "cirurgia_id": null,
                                        "tipo_id": 3,
                                        "tipo_nome": "Consulta de avaliação",
                                        "tipo_cor": "#2F6F62",
                                        "teleconsulta": null,
                                        "profissional_id": 7,
                                        "profissional_nome": "Inês Valente",
                                        "profissional_cor": "#7A4E9C",
                                        "sala_id": 12,
                                        "sala_nome": "Gabinete 2",
                                        "recursos": [
                                            {
                                                "id": 21,
                                                "nome": "Tricoscópio digital",
                                                "tipo": "equipamento"
                                            }
                                        ],
                                        "participantes": [
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "papel": "assistente",
                                                "cor": "#C0743A"
                                            }
                                        ],
                                        "notas": "Pede para ser contactado depois das 18:00.",
                                        "confirmada_em": null,
                                        "confirmacao_canal": null,
                                        "lembrete_enviado_em": null,
                                        "checkin_em": null,
                                        "posto": null,
                                        "atraso_minutos": null,
                                        "motivo_cancelamento": null,
                                        "remarcada_de": null,
                                        "remarcacoes": [],
                                        "politica": "Cancelamentos com menos de 24 h de antecedência perdem o sinal.",
                                        "historico": [
                                            {
                                                "acao": "criada",
                                                "descricao": "Marcada (Equipa)",
                                                "autor": "Ana Ribeiro",
                                                "criado_em": "2026-10-28T09:12:44+00:00"
                                            }
                                        ],
                                        "acoes": [
                                            "confirmar",
                                            "remarcar",
                                            "cancelar",
                                            "lembrete"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/marcacoes/{id}/estado": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6EstadoMarcacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Appointment identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Change status (confirm, arrived, complete, no-show, cancel)",
                "description": "The actions available at each moment come in M6Marcacao.acoes. confirmar (pedido/marcada → confirmada; marcacao.confirmada webhook). chegou (check-in → em_curso; opens the «admission» station on the day board and notifies the professional). concluir (→ concluida; «exit» station). faltou (→ faltou; high-priority «recover no-show» task for reception due in 1 day and a timeline event; the type deposit-loss rule goes into the task). cancelar (only pedido/marcada/confirmada → cancelada; optional reason up to 255 characters; notifies the professional, emails the patient when Settings › Calendar › notify changes is on, offers the slot to the first matching waiting-list entry — task for reception — and fires the marcacao.cancelada webhook). All are recorded in history and audit. Incompatible status → 409 «estado_invalido».",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "acao": {
                                        "type": "string",
                                        "enum": [
                                            "confirmar",
                                            "chegou",
                                            "concluir",
                                            "faltou",
                                            "cancelar"
                                        ]
                                    },
                                    "motivo": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "description": "Cancellation reason (only with «cancelar»)."
                                    }
                                },
                                "required": [
                                    "acao"
                                ]
                            },
                            "example": {
                                "acao": "confirmar"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6ResultadoEstado"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 8840,
                                        "estado": "confirmada",
                                        "mensagem": "Marcação confirmada. Obrigado!",
                                        "marcacao": {
                                            "id": 8840,
                                            "estado": "confirmada",
                                            "estado_rotulo": "Confirmada",
                                            "estado_tom": "sucesso",
                                            "origem": "equipa",
                                            "origem_rotulo": "Equipa",
                                            "inicio": "2026-11-03T10:00:00+00:00",
                                            "fim": "2026-11-03T10:45:00+00:00",
                                            "duracao_min": 45,
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "lead_id": null,
                                            "lead_nome": null,
                                            "episodio_id": 77,
                                            "cirurgia_id": null,
                                            "tipo_id": 3,
                                            "tipo_nome": "Consulta de avaliação",
                                            "tipo_cor": "#2F6F62",
                                            "teleconsulta": null,
                                            "profissional_id": 7,
                                            "profissional_nome": "Inês Valente",
                                            "profissional_cor": "#7A4E9C",
                                            "sala_id": 12,
                                            "sala_nome": "Gabinete 2",
                                            "recursos": [
                                                {
                                                    "id": 21,
                                                    "nome": "Tricoscópio digital",
                                                    "tipo": "equipamento"
                                                }
                                            ],
                                            "participantes": [
                                                {
                                                    "utilizador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "papel": "assistente",
                                                    "cor": "#C0743A"
                                                }
                                            ],
                                            "notas": "Pede para ser contactado depois das 18:00.",
                                            "confirmada_em": "2026-10-28T10:02:11+00:00",
                                            "confirmacao_canal": "equipa",
                                            "lembrete_enviado_em": null,
                                            "checkin_em": null,
                                            "posto": null,
                                            "atraso_minutos": null,
                                            "motivo_cancelamento": null,
                                            "remarcada_de": null,
                                            "remarcacoes": [],
                                            "politica": "Cancelamentos com menos de 24 h de antecedência perdem o sinal.",
                                            "historico": [
                                                {
                                                    "acao": "confirmacao",
                                                    "descricao": "Confirmada pela equipa",
                                                    "autor": "Ana Ribeiro",
                                                    "criado_em": "2026-10-28T10:02:11+00:00"
                                                },
                                                {
                                                    "acao": "criada",
                                                    "descricao": "Marcada (Equipa)",
                                                    "autor": "Ana Ribeiro",
                                                    "criado_em": "2026-10-28T09:12:44+00:00"
                                                }
                                            ],
                                            "acoes": [
                                                "remarcar",
                                                "cancelar",
                                                "lembrete"
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Não é possível neste estado."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/marcacoes/{id}/lembrete": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6LembreteMarcacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Appointment identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Send the reminder now",
                "description": "Sends the patient (or lead) the reminder with date, time and the public link to confirm, cancel or reschedule, through the channels in Settings › Calendar › reminder channels (email, SMS, WhatsApp), in the patient language. «Service» purpose and no clinical details (not even the act type); teleconsultations add the video consultation note. Effects: lembrete_enviado_em and a history row. 422 «lembrete_falhou» when no channel delivered, there is no contact or the appointment is not pedido/marcada/confirmada.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "canais": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "enum": [
                                                            "email",
                                                            "sms",
                                                            "whatsapp"
                                                        ]
                                                    },
                                                    "description": "Channels that delivered."
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "canais": [
                                            "email",
                                            "sms"
                                        ],
                                        "mensagem": "Lembrete enviado."
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Business rule (lembrete_falhou)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "lembrete_falhou": {
                                        "summary": "lembrete_falhou",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "lembrete_falhou",
                                                "mensagem": "Não foi possível enviar o lembrete (sem contacto ou canal desligado)."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/marcacoes/{id}/ligacao": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6LigacaoMarcacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Appointment identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Public appointment link",
                "description": "Address /marcacao/<token> for the patient to confirm, cancel, reschedule, report a delay, check in or join the teleconsultation waiting room, without a session. Valid for at least 7 days (until 2 days after the appointment end); it can be resent without invalidating the previous one. With \"renovar\": true the validity changes and every older link stops working. Only the cryptographic digest of the token is stored.",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "renovar": {
                                        "type": "boolean",
                                        "description": "Invalidate the previous links."
                                    }
                                }
                            },
                            "example": {
                                "renovar": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "url": {
                                                    "type": "string",
                                                    "format": "uri"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "url": "https://clinica.pt/marcacao/q8vN2xY7cTzK4pLmW0sRb3HdFgJ5aE1uQyVnXo6iC9k"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/marcacoes/{id}/mover": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6MoverMarcacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Appointment identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Move or resize (calendar)",
                "description": "Only in pedido, marcada or confirmada (409 «estado_invalido»). Without «fim» the duration is kept. It can change professional or room (drag between columns). Conflicts as on creation (409 «conflito» / «conflito_aviso»; resend with \"forcar\": true). A time change on a confirmed appointment returns it to «marcada» (the patient confirms again) and resets the reminder; with Settings › Calendar › notify changes, the patient receives an email (service purpose, no clinical details) with the new time and the public link. Effects: history and audit. A surgical block is moved through the surgery map: the request is forwarded to the surgery reservation (requires «bloco.marcar» edit) and the response is the reservation one. Response times are clinic local time, without offset.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "inicio": {
                                        "type": "string",
                                        "format": "date-time",
                                        "description": "New start."
                                    },
                                    "fim": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "New end (resize)."
                                    },
                                    "profissional_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "New professional (target column)."
                                    },
                                    "sala_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "New room (target column)."
                                    },
                                    "forcar": {
                                        "type": "boolean",
                                        "description": "Accept the warnings (conflito_aviso: holiday, outside working hours, no working hours, past date). Never overrides blocking conflicts."
                                    }
                                },
                                "required": [
                                    "inicio"
                                ]
                            },
                            "example": {
                                "inicio": "2026-11-03T11:00:00+00:00",
                                "profissional_id": 7,
                                "forcar": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6ResultadoMover"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 8840,
                                        "inicio": "2026-11-03T11:00:00",
                                        "fim": "2026-11-03T11:45:00",
                                        "avisos": []
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (conflito, conflito_aviso, estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "conflito": {
                                        "summary": "conflito",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito",
                                                "mensagem": "Há conflitos na agenda.",
                                                "campos": {
                                                    "profissional_id": "Inês Valente já tem uma marcação das 10:00–10:45.",
                                                    "sala_id": "Gabinete 2 está ocupada (a partir das 10:00)."
                                                }
                                            }
                                        }
                                    },
                                    "conflito_aviso": {
                                        "summary": "conflito_aviso",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito_aviso",
                                                "mensagem": "Há avisos na agenda. Confirme para continuar.",
                                                "campos": {
                                                    "inicio": "É feriado: Implantação da República."
                                                }
                                            }
                                        }
                                    },
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Esta marcação já não pode ser mudada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/marcacoes/{id}/remarcar": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6RemarcarMarcacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Appointment identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Reschedule (new appointment linked to the previous one)",
                "description": "Creates a new appointment with the same patient/lead, type, duration, room, resources, participants and notes (optionally another professional), linked to the previous one through «remarcada_de»; the previous one becomes «remarcada». Conflicts as on creation (409; resend with \"forcar\": true to accept warnings). Effects: history on both, a not-yet-started teleconsultation moves to the new appointment, email to the patient with the new time and the public link (Settings › Calendar › notify changes), slot offered to the waiting list and the marcacao.criada webhook for the new appointment.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "inicio": {
                                        "type": "string",
                                        "format": "date-time",
                                        "description": "New start (duration is kept)."
                                    },
                                    "profissional_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Another professional (optional)."
                                    },
                                    "forcar": {
                                        "type": "boolean",
                                        "description": "Accept the warnings (conflito_aviso: holiday, outside working hours, no working hours, past date). Never overrides blocking conflicts."
                                    }
                                },
                                "required": [
                                    "inicio"
                                ]
                            },
                            "example": {
                                "inicio": "2026-11-05T15:00:00+00:00"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "New appointment."
                                                },
                                                "anterior": {
                                                    "type": "integer",
                                                    "description": "Rescheduled appointment."
                                                },
                                                "avisos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/M6Conflito"
                                                    }
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "marcacao": {
                                                    "$ref": "#/components/schemas/M6Marcacao"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 8861,
                                        "anterior": 8840,
                                        "avisos": [],
                                        "mensagem": "Marcação remarcada.",
                                        "marcacao": {
                                            "id": 8861,
                                            "estado": "marcada",
                                            "estado_rotulo": "Por confirmar",
                                            "estado_tom": "aviso",
                                            "origem": "equipa",
                                            "origem_rotulo": "Equipa",
                                            "inicio": "2026-11-05T15:00:00+00:00",
                                            "fim": "2026-11-05T15:45:00+00:00",
                                            "duracao_min": 45,
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "lead_id": null,
                                            "lead_nome": null,
                                            "episodio_id": 77,
                                            "cirurgia_id": null,
                                            "tipo_id": 3,
                                            "tipo_nome": "Consulta de avaliação",
                                            "tipo_cor": "#2F6F62",
                                            "teleconsulta": null,
                                            "profissional_id": 7,
                                            "profissional_nome": "Inês Valente",
                                            "profissional_cor": "#7A4E9C",
                                            "sala_id": 12,
                                            "sala_nome": "Gabinete 2",
                                            "recursos": [
                                                {
                                                    "id": 21,
                                                    "nome": "Tricoscópio digital",
                                                    "tipo": "equipamento"
                                                }
                                            ],
                                            "participantes": [
                                                {
                                                    "utilizador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "papel": "assistente",
                                                    "cor": "#C0743A"
                                                }
                                            ],
                                            "notas": "Pede para ser contactado depois das 18:00.",
                                            "confirmada_em": null,
                                            "confirmacao_canal": null,
                                            "lembrete_enviado_em": null,
                                            "checkin_em": null,
                                            "posto": null,
                                            "atraso_minutos": null,
                                            "motivo_cancelamento": null,
                                            "remarcada_de": 8840,
                                            "remarcacoes": [
                                                {
                                                    "id": 8840,
                                                    "inicio": "2026-11-03T10:00:00+00:00"
                                                }
                                            ],
                                            "politica": "Cancelamentos com menos de 24 h de antecedência perdem o sinal.",
                                            "historico": [
                                                {
                                                    "acao": "criada",
                                                    "descricao": "Marcada (Equipa)",
                                                    "autor": "Ana Ribeiro",
                                                    "criado_em": "2026-10-28T09:12:44+00:00"
                                                }
                                            ],
                                            "acoes": [
                                                "confirmar",
                                                "remarcar",
                                                "cancelar",
                                                "lembrete"
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (conflito, conflito_aviso, estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "conflito": {
                                        "summary": "conflito",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito",
                                                "mensagem": "Há conflitos na agenda.",
                                                "campos": {
                                                    "profissional_id": "Inês Valente já tem uma marcação das 10:00–10:45.",
                                                    "sala_id": "Gabinete 2 está ocupada (a partir das 10:00)."
                                                }
                                            }
                                        }
                                    },
                                    "conflito_aviso": {
                                        "summary": "conflito_aviso",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito_aviso",
                                                "mensagem": "Há avisos na agenda. Confirme para continuar.",
                                                "campos": {
                                                    "inicio": "É feriado: Implantação da República."
                                                }
                                            }
                                        }
                                    },
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Esta marcação já não pode ser mudada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/ocupacao": {
            "get": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6AgendaOcupacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Occupancy by professional or room",
                "description": "Available hours (from working hours; rooms without hours count the calendar hours on weekdays), hours taken by occupying appointments, percentage and number of appointments. Estimated revenue (base price of the type procedures) is only returned to users with «financeiro.valores» and scope «all». Default: current week.",
                "parameters": [
                    {
                        "name": "inicio",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Start (default Monday this week)."
                    },
                    {
                        "name": "fim",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "End (default start + 7 days)."
                    },
                    {
                        "name": "colunas",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "profissional",
                                "sala",
                                "equipamento"
                            ],
                            "default": "profissional"
                        },
                        "description": "Group by professional, room or equipment (equipment: capacity and maintenance hours)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M6Ocupacao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 7,
                                            "nome": "Inês Valente",
                                            "cor": "#7A4E9C",
                                            "horas_disponiveis": 36,
                                            "horas_ocupadas": 27.5,
                                            "percentagem": 76,
                                            "marcacoes": 31,
                                            "receita": 4650
                                        },
                                        {
                                            "id": 9,
                                            "nome": "Ricardo Lemos",
                                            "cor": "#2F6F62",
                                            "horas_disponiveis": 20,
                                            "horas_ocupadas": 8,
                                            "percentagem": 40,
                                            "marcacoes": 9,
                                            "receita": 1350
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/quiosque/codigo": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6QuiosqueCodigo",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Kiosk check-in (code or QR)",
                "description": "Today’s 6-character check-in code or the QR content (personal link). Only today’s in-person appointments within the configured window. Minimal answer: first name and initial, time, room, professional.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "codigo": {
                                        "type": "string",
                                        "maxLength": 300
                                    }
                                },
                                "required": [
                                    "codigo"
                                ]
                            },
                            "example": {
                                "codigo": "K7M 3QX"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "ja_tinha": {
                                                    "type": "boolean"
                                                },
                                                "nome": {
                                                    "type": "string"
                                                },
                                                "hora": {
                                                    "type": "string"
                                                },
                                                "local": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "profissional": {
                                                    "type": "string"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "ja_tinha": false,
                                        "nome": "Rui A.",
                                        "hora": "10:30",
                                        "local": "Gabinete 2",
                                        "profissional": "Inês Valente",
                                        "mensagem": "Bem-vindo(a), Rui A. A sua chegada foi registada; vai ser chamado(a) em breve."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/quiosque/telefone": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6QuiosqueTelefone",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Kiosk check-in (mobile and date of birth)",
                "description": "Matched by the last 9 phone digits and date of birth; today’s nearest appointment without check-in.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "telefone": {
                                        "type": "string",
                                        "maxLength": 30
                                    },
                                    "data_nascimento": {
                                        "type": "string",
                                        "format": "date"
                                    }
                                },
                                "required": [
                                    "telefone",
                                    "data_nascimento"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/quiosques": {
            "get": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6QuiosquesListar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Reception check-in kiosks",
                "description": "Tablets with the /quiosque/<code> address.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 2,
                                            "nome": "Receção — entrada",
                                            "prefixo": "7d2c3b8a",
                                            "ativo": true,
                                            "checkins": 133,
                                            "ultimo_uso_em": "2026-11-03T09:12:00+00:00",
                                            "bloqueado": false
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6QuiosquesCriar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Create a kiosk",
                "description": "256-bit code; only the digest is stored. The address is returned only once.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string",
                                        "maxLength": 80
                                    }
                                },
                                "required": [
                                    "nome"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "url": {
                                                    "type": "string",
                                                    "format": "uri"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 3,
                                        "url": "https://clinica.pt/quiosque/7d2c3b8a…"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/quiosques/{id}/revogar": {
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6QuiosquesRevogar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "summary": "Revoke a kiosk",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/sala-espera": {
            "get": {
                "tags": [
                    "Fluxo do dia"
                ],
                "operationId": "m6SalaEspera",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Waiting-room screen",
                "description": "For the waiting-room television (screen «sala_espera»): who is being seen (up to 6) and who is next (up to 8) today, with first name and surname initial only, the room and the time. Surgical blocks are excluded.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6SalaEspera"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "atendidos": [
                                            {
                                                "nome": "Rui A.",
                                                "sala": "Gabinete 2",
                                                "hora": "10:00"
                                            }
                                        ],
                                        "seguintes": [
                                            {
                                                "nome": "Carla N.",
                                                "sala": "Gabinete 1",
                                                "hora": "10:30"
                                            },
                                            {
                                                "nome": "Tiago M.",
                                                "sala": "Gabinete 2",
                                                "hora": "11:00"
                                            }
                                        ],
                                        "hora": "10:07"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/agenda/sincronizar": {
            "get": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6SincronizacaoEstado",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Personal calendar link status",
                "description": "Whether the person has an active subscription link (iCalendar format, read-only), its first 8 characters to recognise it and the last use. The full link is never returned here.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Sincronizacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ativa": true,
                                        "prefixo": "9c1f04ab",
                                        "ultimo_uso_em": "2026-10-28T06:00:12+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6SincronizacaoGerar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Generate the personal calendar link",
                "description": "Generates a new link (revokes the previous one) to subscribe to the own appointments in an external calendar application. The link is shown only once. Data protection: the external calendar never receives the patient name or clinical details — only the act type, the room and the link to open the appointment in AnagenSys (which requires a session). 256-bit token; only the cryptographic digest is stored. Limit: 10 requests per 10 minutes. Effects: audit.",
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/M6Sincronizacao"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "url": {
                                                            "type": "string",
                                                            "format": "uri",
                                                            "description": "Show only once."
                                                        }
                                                    }
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "url": "https://clinica.pt/agenda/ics/9c1f04ab5e7d2c3b8a6f1e0d4c9b2a7f3e5d8c1b6a4f2e9d0c7b5a3f1e8d6c4b.ics",
                                        "ativa": true,
                                        "prefixo": "9c1f04ab",
                                        "ultimo_uso_em": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Agenda"
                ],
                "operationId": "m6SincronizacaoRevogar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "ver",
                "summary": "Revoke the personal calendar link",
                "description": "The subscription stops receiving data immediately. Effects: «revoke» audit.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Sincronizacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ativa": false,
                                        "prefixo": null,
                                        "ultimo_uso_em": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ajuda": {
            "get": {
                "tags": [
                    "Ajuda"
                ],
                "operationId": "ajuda",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Help articles (list, search or contextual)",
                "description": "No parameters: visible articles (team: by permissions; patient: portal only). ?q= searches. ?ecra=<screen or resource key> returns that screen article (404 if none).",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 80
                        }
                    },
                    {
                        "name": "ecra",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-z0-9_]{2,60}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "oneOf": [
                                                {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "chave": {
                                                                "type": "string"
                                                            },
                                                            "titulo": {
                                                                "type": "string"
                                                            },
                                                            "resumo": {
                                                                "type": "string"
                                                            },
                                                            "capitulo": {
                                                                "type": "string"
                                                            },
                                                            "tipo": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "artigo",
                                                                    "primeiros_passos",
                                                                    "faq",
                                                                    "glossario",
                                                                    "atalhos"
                                                                ]
                                                            },
                                                            "modulo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "perfis": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "palavras": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "ordem": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "chave": {
                                                            "type": "string"
                                                        },
                                                        "titulo": {
                                                            "type": "string"
                                                        },
                                                        "resumo": {
                                                            "type": "string"
                                                        },
                                                        "capitulo": {
                                                            "type": "string"
                                                        },
                                                        "tipo": {
                                                            "type": "string",
                                                            "enum": [
                                                                "artigo",
                                                                "primeiros_passos",
                                                                "faq",
                                                                "glossario",
                                                                "atalhos"
                                                            ]
                                                        },
                                                        "modulo": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "perfis": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "palavras": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "ordem": {
                                                            "type": "integer"
                                                        }
                                                    }
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/ajuda/manual": {
            "get": {
                "tags": [
                    "Ajuda"
                ],
                "operationId": "manual",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "System Manual (numbered chapters and sections)",
                "parameters": [
                    {
                        "name": "conteudo",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        },
                        "description": "1 = include each section HTML"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "numero": {
                                                        "type": "integer"
                                                    },
                                                    "chave": {
                                                        "type": "string"
                                                    },
                                                    "titulo": {
                                                        "type": "string"
                                                    },
                                                    "icone": {
                                                        "type": "string"
                                                    },
                                                    "seccoes": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object"
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/ajuda/{chave}": {
            "get": {
                "tags": [
                    "Ajuda"
                ],
                "operationId": "ajudaArtigo",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "One article (sanitised HTML and related)",
                "parameters": [
                    {
                        "name": "chave",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "chave": {
                                                    "type": "string"
                                                },
                                                "titulo": {
                                                    "type": "string"
                                                },
                                                "resumo": {
                                                    "type": "string"
                                                },
                                                "capitulo": {
                                                    "type": "string"
                                                },
                                                "tipo": {
                                                    "type": "string",
                                                    "enum": [
                                                        "artigo",
                                                        "primeiros_passos",
                                                        "faq",
                                                        "glossario",
                                                        "atalhos"
                                                    ]
                                                },
                                                "modulo": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "perfis": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "palavras": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "ordem": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/ambiente": {
            "get": {
                "tags": [
                    "Ambiente"
                ],
                "operationId": "ambienteDeExecucao",
                "security": [],
                "summary": "Server environment",
                "description": "Public (60 requests per minute per address). Never includes addresses or the list of authorised destinations.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/AmbienteExecucao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ambiente": "testes",
                                        "producao": false,
                                        "titulo": "Ambiente de testes",
                                        "texto": "Os dados são de teste e nada sai para o exterior…",
                                        "tom": "aviso",
                                        "canais_permitidos": [],
                                        "destinos_restritos": false,
                                        "dados": {
                                            "tipo": "sinteticos",
                                            "rotulo": "dados sintéticos",
                                            "em": "2026-10-29 15:02:11",
                                            "aviso": null
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/aparelhos": {
            "get": {
                "tags": [
                    "Avisos no telemóvel"
                ],
                "operationId": "aparelhosListar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "My devices",
                "description": "The person’s devices with a live session (ended sessions are deleted). «este» = the request’s session. Never returns tokens.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 14,
                                            "plataforma": "ios",
                                            "nome": "iPhone de Inês (iOS 19.1)",
                                            "lingua": "pt-PT",
                                            "versao_app": "1.0.0+1",
                                            "ultima_atividade_em": "2026-10-29T09:12:00+00:00",
                                            "ultimo_envio_em": "2026-10-29T09:30:41+00:00",
                                            "envios": 37,
                                            "falhas": 0,
                                            "este": true,
                                            "criado_em": "2026-10-29T08:01:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "tags": [
                    "Avisos no telemóvel"
                ],
                "operationId": "aparelhosRegistar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Register this device",
                "description": "Registers or updates the device of the current app session. The token is encrypted; the same device in another account or clinic is removed there. One device per session; at most 10 per person. Limit: 30 requests/10 min.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "token",
                                    "fornecedor",
                                    "plataforma"
                                ],
                                "properties": {
                                    "token": {
                                        "type": "string",
                                        "minLength": 20,
                                        "maxLength": 4096
                                    },
                                    "fornecedor": {
                                        "type": "string",
                                        "enum": [
                                            "fcm",
                                            "apns"
                                        ]
                                    },
                                    "plataforma": {
                                        "type": "string",
                                        "enum": [
                                            "android",
                                            "ios",
                                            "macos"
                                        ]
                                    },
                                    "ambiente": {
                                        "type": "string",
                                        "enum": [
                                            "producao",
                                            "desenvolvimento"
                                        ]
                                    },
                                    "lingua": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    },
                                    "nome": {
                                        "type": "string",
                                        "maxLength": 120
                                    },
                                    "versao_app": {
                                        "type": "string",
                                        "maxLength": 30
                                    }
                                }
                            },
                            "example": {
                                "token": "f3k9…:APA91b…",
                                "fornecedor": "fcm",
                                "plataforma": "android",
                                "ambiente": "producao",
                                "lingua": "pt-PT",
                                "nome": "Samsung SM-S921B",
                                "versao_app": "1.0.0+1"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 14,
                                        "plataforma": "ios",
                                        "nome": "iPhone de Inês (iOS 19.1)",
                                        "lingua": "pt-PT",
                                        "versao_app": "1.0.0+1",
                                        "ultima_atividade_em": "2026-10-29T09:12:00+00:00",
                                        "ultimo_envio_em": "2026-10-29T09:30:41+00:00",
                                        "envios": 37,
                                        "falhas": 0,
                                        "este": true,
                                        "criado_em": "2026-10-29T08:01:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/aparelhos/configuracao": {
            "get": {
                "tags": [
                    "Avisos no telemóvel"
                ],
                "operationId": "aparelhosConfiguracao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Public notification configuration",
                "description": "Whether notifications are on and, per platform, whether it is ready, the delivery route and the PUBLIC project identifiers for the app to start the service. Never returns credentials. Also returns the categories with the person’s preference.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ativo": {
                                                    "type": "boolean"
                                                },
                                                "plataformas": {
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "object",
                                                        "properties": {
                                                            "ativo": {
                                                                "type": "boolean"
                                                            },
                                                            "fornecedor": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "fcm",
                                                                    "apns",
                                                                    "local"
                                                                ]
                                                            },
                                                            "projeto": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ],
                                                                "properties": {
                                                                    "app_id": {
                                                                        "type": "string"
                                                                    },
                                                                    "api_key": {
                                                                        "type": "string"
                                                                    },
                                                                    "remetente": {
                                                                        "type": "string"
                                                                    },
                                                                    "projeto": {
                                                                        "type": "string"
                                                                    }
                                                                }
                                                            },
                                                            "pacote": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                },
                                                "categorias": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "chave": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "mensagens",
                                                                    "agenda",
                                                                    "tarefas",
                                                                    "documentos",
                                                                    "pagamentos",
                                                                    "alertas",
                                                                    "geral"
                                                                ]
                                                            },
                                                            "rotulo": {
                                                                "type": "string"
                                                            },
                                                            "descricao": {
                                                                "type": "string"
                                                            },
                                                            "push": {
                                                                "type": "boolean"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ativo": true,
                                        "plataformas": {
                                            "android": {
                                                "ativo": true,
                                                "fornecedor": "fcm",
                                                "projeto": {
                                                    "app_id": "1:123456789012:android:abc123",
                                                    "api_key": "AIza…",
                                                    "remetente": "123456789012",
                                                    "projeto": "anagensys-avisos"
                                                }
                                            },
                                            "ios": {
                                                "ativo": true,
                                                "fornecedor": "apns",
                                                "projeto": {
                                                    "app_id": "1:123456789012:ios:def456",
                                                    "api_key": "AIza…",
                                                    "remetente": "123456789012",
                                                    "projeto": "anagensys-avisos"
                                                },
                                                "pacote": "pt.anagen.anagensys"
                                            },
                                            "windows": {
                                                "ativo": true,
                                                "fornecedor": "local",
                                                "projeto": null
                                            }
                                        },
                                        "categorias": [
                                            {
                                                "chave": "mensagens",
                                                "rotulo": "Mensagens",
                                                "descricao": "Mensagens de pacientes e da equipa, menções e comunicados.",
                                                "push": true
                                            },
                                            {
                                                "chave": "agenda",
                                                "rotulo": "Agenda e marcações",
                                                "descricao": "Marcações, teleconsultas, bloco operatório e reuniões.",
                                                "push": false
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/aparelhos/plataforma": {
            "get": {
                "tags": [
                    "Avisos no telemóvel"
                ],
                "operationId": "aparelhosPlataforma",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Notification service status (super administrators)",
                "description": "Configuration (no secrets), devices per platform and last-24h notifications per state, across clinics — counts only. 403 for non super administrators.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "configuracao": {
                                                    "type": "object"
                                                },
                                                "aparelhos": {
                                                    "type": "object"
                                                },
                                                "ultimas_24h": {
                                                    "type": "object"
                                                },
                                                "ultima_execucao": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "em": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        },
                                                        "estado": {
                                                            "type": "string"
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/aparelhos/{id}": {
            "delete": {
                "tags": [
                    "Avisos no telemóvel"
                ],
                "operationId": "aparelhosRemover",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Stop receiving on this device",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/aparelhos/{id}/testar": {
            "post": {
                "tags": [
                    "Avisos no telemóvel"
                ],
                "operationId": "aparelhosTestar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Send test notification",
                "description": "Sends a test notification to the person’s own device. ok:false when the service refuses (invalid token → device deleted). 409 when notifications are off or in a test environment. Limit: 5/10 min.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "mensagem": "Aviso de teste enviado. Deve chegar ao aparelho dentro de momentos."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/atividade": {
            "get": {
                "tags": [
                    "Atividade"
                ],
                "operationId": "atividade",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "ver",
                "summary": "Activity log (list)",
                "description": "Newest first; default period: last 7 days (max 366). Filters in f[…] (or top level, except pagina). depois_id returns only newer rows (up to 100) for live updates. meta: {pagina, por_pagina, total, ultimo_id, filtros, periodo, clinica, exportar}.",
                "parameters": [
                    {
                        "name": "f[ator]",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Team member"
                    },
                    {
                        "name": "f[ator_tipo]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "utilizador",
                                "paciente",
                                "integracao",
                                "sistema",
                                "anonimo"
                            ]
                        }
                    },
                    {
                        "name": "f[acao]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "entrou",
                                "saiu",
                                "falhou_entrada",
                                "abriu",
                                "viu",
                                "criou",
                                "alterou",
                                "eliminou",
                                "exportou",
                                "imprimiu",
                                "descarregou",
                                "enviou",
                                "assinou",
                                "aprovou",
                                "revogou",
                                "pesquisou",
                                "acesso_emergencia"
                            ]
                        }
                    },
                    {
                        "name": "f[familia]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "consultas",
                                "alteracoes",
                                "entradas",
                                "saidas"
                            ]
                        }
                    },
                    {
                        "name": "f[paciente]",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "f[alvo_tipo]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[alvo_id]",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "f[pagina]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Page or screen label (exact)"
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "web",
                                "app",
                                "api",
                                "integracao",
                                "agendador"
                            ]
                        }
                    },
                    {
                        "name": "f[de]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "f[ate]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "f[dia]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "f[hora]",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 23
                        }
                    },
                    {
                        "name": "f[q]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Person, page, detail or address"
                    },
                    {
                        "name": "f[fora_horas]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        }
                    },
                    {
                        "name": "clinica",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Platform management only: another clinic id or «todas». Everyone else always gets the context clinic."
                    },
                    {
                        "name": "depois_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "quando": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "clinica_id": {
                                                        "type": "integer"
                                                    },
                                                    "ator": {
                                                        "type": "object",
                                                        "properties": {
                                                            "tipo": {
                                                                "type": "string"
                                                            },
                                                            "id": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "nome": {
                                                                "type": "string"
                                                            },
                                                            "perfil": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "perfil_rotulo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "ligacao": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ],
                                                                "properties": {
                                                                    "tipo": {
                                                                        "type": "string"
                                                                    },
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "pode_abrir": {
                                                                        "type": "boolean"
                                                                    },
                                                                    "web": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "app": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "acao": {
                                                        "type": "string",
                                                        "enum": [
                                                            "entrou",
                                                            "saiu",
                                                            "falhou_entrada",
                                                            "abriu",
                                                            "viu",
                                                            "criou",
                                                            "alterou",
                                                            "eliminou",
                                                            "exportou",
                                                            "imprimiu",
                                                            "descarregou",
                                                            "enviou",
                                                            "assinou",
                                                            "aprovou",
                                                            "revogou",
                                                            "pesquisou",
                                                            "acesso_emergencia"
                                                        ]
                                                    },
                                                    "acao_rotulo": {
                                                        "type": "string"
                                                    },
                                                    "tom": {
                                                        "type": "string"
                                                    },
                                                    "pagina": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "pagina_rotulo": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "modulo": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "ecra": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "alvo": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "tipo": {
                                                                "type": "string"
                                                            },
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "pode_abrir": {
                                                                "type": "boolean"
                                                            },
                                                            "web": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "app": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        }
                                                    },
                                                    "paciente": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "nome": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "ligacao": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ],
                                                                "properties": {
                                                                    "tipo": {
                                                                        "type": "string"
                                                                    },
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "pode_abrir": {
                                                                        "type": "boolean"
                                                                    },
                                                                    "web": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "app": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "lead_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "campos": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "detalhe": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "origem": {
                                                        "type": "string",
                                                        "enum": [
                                                            "web",
                                                            "app",
                                                            "api",
                                                            "integracao",
                                                            "agendador"
                                                        ]
                                                    },
                                                    "origem_rotulo": {
                                                        "type": "string"
                                                    },
                                                    "plataforma": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "dispositivo": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "ip": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "metodo": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "http": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "duracao_ms": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "pedido_id": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "pagina": {
                                                    "type": "integer"
                                                },
                                                "por_pagina": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "ultimo_id": {
                                                    "type": "integer"
                                                },
                                                "exportar": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 48211,
                                            "quando": "2026-10-28T10:14:03+00:00",
                                            "clinica_id": 1,
                                            "ator": {
                                                "tipo": "utilizador",
                                                "id": 7,
                                                "nome": "Inês Valente",
                                                "perfil": "medico",
                                                "perfil_rotulo": "Médico",
                                                "ligacao": {
                                                    "tipo": "utilizadores",
                                                    "id": 7,
                                                    "pode_abrir": true,
                                                    "web": "equipa/r/utilizadores/7",
                                                    "app": "/r/utilizadores/7"
                                                }
                                            },
                                            "acao": "alterou",
                                            "acao_rotulo": "Alterou",
                                            "tom": "ouro",
                                            "pagina": "api/v1/r/propostas/31",
                                            "pagina_rotulo": "Propostas",
                                            "modulo": "comercial.propostas",
                                            "ecra": null,
                                            "alvo": {
                                                "tipo": "propostas",
                                                "id": 31,
                                                "pode_abrir": true,
                                                "web": "equipa/r/propostas/31",
                                                "app": "/r/propostas/31"
                                            },
                                            "paciente": {
                                                "id": 12,
                                                "nome": "Rita Matos",
                                                "ligacao": {
                                                    "tipo": "pacientes",
                                                    "id": 12,
                                                    "pode_abrir": true,
                                                    "web": "equipa/r/pacientes/12",
                                                    "app": "/r/pacientes/12"
                                                }
                                            },
                                            "lead_id": null,
                                            "campos": [
                                                "desconto",
                                                "validade"
                                            ],
                                            "detalhe": null,
                                            "origem": "app",
                                            "origem_rotulo": "Aplicação",
                                            "plataforma": "ios",
                                            "dispositivo": "Aplicação em ios · 1.0.0+1",
                                            "ip": "85.240.10.20",
                                            "metodo": "PUT",
                                            "http": 200,
                                            "duracao_ms": 84,
                                            "pedido_id": "b1c0…"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/atividade/exportar": {
            "get": {
                "tags": [
                    "Atividade"
                ],
                "operationId": "atividadeExportar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "ver",
                "summary": "Export CSV (requires «export»; the export is logged)",
                "parameters": [
                    {
                        "name": "f[ator]",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Team member"
                    },
                    {
                        "name": "f[ator_tipo]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "utilizador",
                                "paciente",
                                "integracao",
                                "sistema",
                                "anonimo"
                            ]
                        }
                    },
                    {
                        "name": "f[acao]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "entrou",
                                "saiu",
                                "falhou_entrada",
                                "abriu",
                                "viu",
                                "criou",
                                "alterou",
                                "eliminou",
                                "exportou",
                                "imprimiu",
                                "descarregou",
                                "enviou",
                                "assinou",
                                "aprovou",
                                "revogou",
                                "pesquisou",
                                "acesso_emergencia"
                            ]
                        }
                    },
                    {
                        "name": "f[familia]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "consultas",
                                "alteracoes",
                                "entradas",
                                "saidas"
                            ]
                        }
                    },
                    {
                        "name": "f[paciente]",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "f[alvo_tipo]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[alvo_id]",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "f[pagina]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Page or screen label (exact)"
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "web",
                                "app",
                                "api",
                                "integracao",
                                "agendador"
                            ]
                        }
                    },
                    {
                        "name": "f[de]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "f[ate]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "f[dia]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "f[hora]",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 23
                        }
                    },
                    {
                        "name": "f[q]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Person, page, detail or address"
                    },
                    {
                        "name": "f[fora_horas]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        }
                    },
                    {
                        "name": "clinica",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Platform management only: another clinic id or «todas». Everyone else always gets the context clinic."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "CSV",
                        "content": {
                            "text/csv": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/atividade/navegacao": {
            "post": {
                "tags": [
                    "Atividade"
                ],
                "operationId": "atividadeNavegacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "App navigation (opened screens, batched)",
                "description": "Up to 50 events per batch; path only (no query), screen/resource key and numeric id. The same event is not repeated within 10 minutes; cap of 120 rows per account per 10 minutes. Effect: «abriu»/«viu» rows in the activity log.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "eventos": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "tipo",
                                                "rota"
                                            ],
                                            "properties": {
                                                "tipo": {
                                                    "type": "string",
                                                    "enum": [
                                                        "ecra",
                                                        "separador",
                                                        "folha"
                                                    ]
                                                },
                                                "rota": {
                                                    "type": "string"
                                                },
                                                "chave": {
                                                    "type": "string"
                                                },
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "titulo": {
                                                    "type": "string"
                                                },
                                                "em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "eventos"
                                ]
                            },
                            "example": {
                                "eventos": [
                                    {
                                        "tipo": "ecra",
                                        "rota": "/e/funil",
                                        "chave": "funil",
                                        "em": "2026-10-28T10:01:00Z"
                                    },
                                    {
                                        "tipo": "ecra",
                                        "rota": "/r/pacientes/12",
                                        "chave": "pacientes",
                                        "id": 12
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "aceites": {
                                                    "type": "integer"
                                                },
                                                "ignorados": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "aceites": 2,
                                        "ignorados": 0
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/atividade/pessoa/{id}": {
            "get": {
                "tags": [
                    "Atividade"
                ],
                "operationId": "atividadeDiaDaPessoa",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "ver",
                "summary": "The person’s day",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "dia",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "pessoa": {
                                                    "type": "object"
                                                },
                                                "dia": {
                                                    "type": "string"
                                                },
                                                "primeira": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "ultima": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "por_acao": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "por_hora": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "cronologia": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "quando": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            },
                                                            "clinica_id": {
                                                                "type": "integer"
                                                            },
                                                            "ator": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "tipo": {
                                                                        "type": "string"
                                                                    },
                                                                    "id": {
                                                                        "type": [
                                                                            "integer",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "nome": {
                                                                        "type": "string"
                                                                    },
                                                                    "perfil": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "perfil_rotulo": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "ligacao": {
                                                                        "type": [
                                                                            "object",
                                                                            "null"
                                                                        ],
                                                                        "properties": {
                                                                            "tipo": {
                                                                                "type": "string"
                                                                            },
                                                                            "id": {
                                                                                "type": "integer"
                                                                            },
                                                                            "pode_abrir": {
                                                                                "type": "boolean"
                                                                            },
                                                                            "web": {
                                                                                "type": [
                                                                                    "string",
                                                                                    "null"
                                                                                ]
                                                                            },
                                                                            "app": {
                                                                                "type": [
                                                                                    "string",
                                                                                    "null"
                                                                                ]
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            },
                                                            "acao": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "entrou",
                                                                    "saiu",
                                                                    "falhou_entrada",
                                                                    "abriu",
                                                                    "viu",
                                                                    "criou",
                                                                    "alterou",
                                                                    "eliminou",
                                                                    "exportou",
                                                                    "imprimiu",
                                                                    "descarregou",
                                                                    "enviou",
                                                                    "assinou",
                                                                    "aprovou",
                                                                    "revogou",
                                                                    "pesquisou",
                                                                    "acesso_emergencia"
                                                                ]
                                                            },
                                                            "acao_rotulo": {
                                                                "type": "string"
                                                            },
                                                            "tom": {
                                                                "type": "string"
                                                            },
                                                            "pagina": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "pagina_rotulo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "modulo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "ecra": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "alvo": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ],
                                                                "properties": {
                                                                    "tipo": {
                                                                        "type": "string"
                                                                    },
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "pode_abrir": {
                                                                        "type": "boolean"
                                                                    },
                                                                    "web": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "app": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    }
                                                                }
                                                            },
                                                            "paciente": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ],
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "nome": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "ligacao": {
                                                                        "type": [
                                                                            "object",
                                                                            "null"
                                                                        ],
                                                                        "properties": {
                                                                            "tipo": {
                                                                                "type": "string"
                                                                            },
                                                                            "id": {
                                                                                "type": "integer"
                                                                            },
                                                                            "pode_abrir": {
                                                                                "type": "boolean"
                                                                            },
                                                                            "web": {
                                                                                "type": [
                                                                                    "string",
                                                                                    "null"
                                                                                ]
                                                                            },
                                                                            "app": {
                                                                                "type": [
                                                                                    "string",
                                                                                    "null"
                                                                                ]
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            },
                                                            "lead_id": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "campos": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "detalhe": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "origem": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "web",
                                                                    "app",
                                                                    "api",
                                                                    "integracao",
                                                                    "agendador"
                                                                ]
                                                            },
                                                            "origem_rotulo": {
                                                                "type": "string"
                                                            },
                                                            "plataforma": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "dispositivo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "ip": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "metodo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "http": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "duracao_ms": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "pedido_id": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                },
                                                "pacientes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "aparelhos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/atividade/pessoas": {
            "get": {
                "tags": [
                    "Atividade"
                ],
                "operationId": "atividadePessoas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "ver",
                "summary": "People in the log (90 days), for the filter",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "nome": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 7,
                                            "nome": "Inês Valente"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/atividade/resumo": {
            "get": {
                "tags": [
                    "Atividade"
                ],
                "operationId": "atividadeResumo",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "ver",
                "summary": "Summary of the filtered period",
                "description": "totals; per action; people (most active); pages; most viewed patients; series {granularity: hour|day, points}; em_foco [{tipo, tom, icone, titulo, texto, filtro}].",
                "parameters": [
                    {
                        "name": "f[ator]",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Team member"
                    },
                    {
                        "name": "f[ator_tipo]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "utilizador",
                                "paciente",
                                "integracao",
                                "sistema",
                                "anonimo"
                            ]
                        }
                    },
                    {
                        "name": "f[acao]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "entrou",
                                "saiu",
                                "falhou_entrada",
                                "abriu",
                                "viu",
                                "criou",
                                "alterou",
                                "eliminou",
                                "exportou",
                                "imprimiu",
                                "descarregou",
                                "enviou",
                                "assinou",
                                "aprovou",
                                "revogou",
                                "pesquisou",
                                "acesso_emergencia"
                            ]
                        }
                    },
                    {
                        "name": "f[familia]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "consultas",
                                "alteracoes",
                                "entradas",
                                "saidas"
                            ]
                        }
                    },
                    {
                        "name": "f[paciente]",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "f[alvo_tipo]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[alvo_id]",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "f[pagina]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Page or screen label (exact)"
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "web",
                                "app",
                                "api",
                                "integracao",
                                "agendador"
                            ]
                        }
                    },
                    {
                        "name": "f[de]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "f[ate]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "f[dia]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "f[hora]",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 23
                        }
                    },
                    {
                        "name": "f[q]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Person, page, detail or address"
                    },
                    {
                        "name": "f[fora_horas]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        }
                    },
                    {
                        "name": "clinica",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Platform management only: another clinic id or «todas». Everyone else always gets the context clinic."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "totais": {
                                            "acoes": 1840,
                                            "pessoas": 14,
                                            "pacientes": 212,
                                            "paginas": 37
                                        },
                                        "em_foco": [
                                            {
                                                "tipo": "saidas",
                                                "tom": "aviso",
                                                "icone": "exportar",
                                                "titulo": "6 exportações, impressões ou descargas",
                                                "texto": "Dados que saíram da plataforma no período.",
                                                "filtro": {
                                                    "familia": "saidas"
                                                }
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/atividade/{id}": {
            "get": {
                "tags": [
                    "Atividade"
                ],
                "operationId": "atividadeDetalhe",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "ver",
                "summary": "One log row",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "quando": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "clinica_id": {
                                                    "type": "integer"
                                                },
                                                "ator": {
                                                    "type": "object",
                                                    "properties": {
                                                        "tipo": {
                                                            "type": "string"
                                                        },
                                                        "id": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "nome": {
                                                            "type": "string"
                                                        },
                                                        "perfil": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "perfil_rotulo": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "ligacao": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "tipo": {
                                                                    "type": "string"
                                                                },
                                                                "id": {
                                                                    "type": "integer"
                                                                },
                                                                "pode_abrir": {
                                                                    "type": "boolean"
                                                                },
                                                                "web": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "app": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                "acao": {
                                                    "type": "string",
                                                    "enum": [
                                                        "entrou",
                                                        "saiu",
                                                        "falhou_entrada",
                                                        "abriu",
                                                        "viu",
                                                        "criou",
                                                        "alterou",
                                                        "eliminou",
                                                        "exportou",
                                                        "imprimiu",
                                                        "descarregou",
                                                        "enviou",
                                                        "assinou",
                                                        "aprovou",
                                                        "revogou",
                                                        "pesquisou",
                                                        "acesso_emergencia"
                                                    ]
                                                },
                                                "acao_rotulo": {
                                                    "type": "string"
                                                },
                                                "tom": {
                                                    "type": "string"
                                                },
                                                "pagina": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "pagina_rotulo": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "modulo": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "ecra": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "alvo": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "tipo": {
                                                            "type": "string"
                                                        },
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "pode_abrir": {
                                                            "type": "boolean"
                                                        },
                                                        "web": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "app": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    }
                                                },
                                                "paciente": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "nome": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "ligacao": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "tipo": {
                                                                    "type": "string"
                                                                },
                                                                "id": {
                                                                    "type": "integer"
                                                                },
                                                                "pode_abrir": {
                                                                    "type": "boolean"
                                                                },
                                                                "web": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "app": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                "lead_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "campos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "detalhe": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "origem": {
                                                    "type": "string",
                                                    "enum": [
                                                        "web",
                                                        "app",
                                                        "api",
                                                        "integracao",
                                                        "agendador"
                                                    ]
                                                },
                                                "origem_rotulo": {
                                                    "type": "string"
                                                },
                                                "plataforma": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "dispositivo": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "ip": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "metodo": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "http": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "duracao_ms": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "pedido_id": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 48211,
                                        "quando": "2026-10-28T10:14:03+00:00",
                                        "clinica_id": 1,
                                        "ator": {
                                            "tipo": "utilizador",
                                            "id": 7,
                                            "nome": "Inês Valente",
                                            "perfil": "medico",
                                            "perfil_rotulo": "Médico",
                                            "ligacao": {
                                                "tipo": "utilizadores",
                                                "id": 7,
                                                "pode_abrir": true,
                                                "web": "equipa/r/utilizadores/7",
                                                "app": "/r/utilizadores/7"
                                            }
                                        },
                                        "acao": "alterou",
                                        "acao_rotulo": "Alterou",
                                        "tom": "ouro",
                                        "pagina": "api/v1/r/propostas/31",
                                        "pagina_rotulo": "Propostas",
                                        "modulo": "comercial.propostas",
                                        "ecra": null,
                                        "alvo": {
                                            "tipo": "propostas",
                                            "id": 31,
                                            "pode_abrir": true,
                                            "web": "equipa/r/propostas/31",
                                            "app": "/r/propostas/31"
                                        },
                                        "paciente": {
                                            "id": 12,
                                            "nome": "Rita Matos",
                                            "ligacao": {
                                                "tipo": "pacientes",
                                                "id": 12,
                                                "pode_abrir": true,
                                                "web": "equipa/r/pacientes/12",
                                                "app": "/r/pacientes/12"
                                            }
                                        },
                                        "lead_id": null,
                                        "campos": [
                                            "desconto",
                                            "validade"
                                        ],
                                        "detalhe": null,
                                        "origem": "app",
                                        "origem_rotulo": "Aplicação",
                                        "plataforma": "ios",
                                        "dispositivo": "Aplicação em ios · 1.0.0+1",
                                        "ip": "85.240.10.20",
                                        "metodo": "PUT",
                                        "http": 200,
                                        "duracao_ms": 84,
                                        "pedido_id": "b1c0…"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/auditoria": {
            "get": {
                "tags": [
                    "Auditoria"
                ],
                "operationId": "auditoria",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Audit log",
                "description": "Filters at the top level (ator_id, paciente_id, acao, recurso, origem, de, ate) or in f[…]. Dates YYYY-MM-DD. Requires Audit › View.",
                "parameters": [
                    {
                        "name": "ator_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "acao",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "ver",
                                "criar",
                                "alterar",
                                "apagar",
                                "exportar",
                                "imprimir",
                                "entrar",
                                "sair",
                                "falha_entrada",
                                "acesso_emergencia",
                                "aprovar",
                                "enviar",
                                "assinar",
                                "revogar",
                                "descarregar"
                            ]
                        }
                    },
                    {
                        "name": "recurso",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "origem",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "web",
                                "api",
                                "gancho",
                                "agendador"
                            ]
                        }
                    },
                    {
                        "name": "de",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/auditoria/exportar": {
            "get": {
                "tags": [
                    "Auditoria"
                ],
                "operationId": "auditoriaExportar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Export CSV (requires «export»; the export is logged)",
                "responses": {
                    "200": {
                        "description": "CSV",
                        "content": {
                            "text/csv": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/auditoria/verificar": {
            "get": {
                "tags": [
                    "Auditoria"
                ],
                "operationId": "verificarCadeia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Verify chain integrity",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "integra": {
                                                    "type": "boolean"
                                                },
                                                "intacta": {
                                                    "type": "boolean"
                                                },
                                                "verificados": {
                                                    "type": "integer"
                                                },
                                                "primeira_quebra_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "quebra_em": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "integra": true,
                                        "intacta": true,
                                        "verificados": 18342,
                                        "primeira_quebra_id": null,
                                        "quebra_em": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "tags": [
                    "Auditoria"
                ],
                "operationId": "verificarCadeiaPost",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Verify chain integrity",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/auditoria/{id}": {
            "get": {
                "tags": [
                    "Auditoria"
                ],
                "operationId": "auditoriaDetalhe",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Row detail",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/auth/2fa": {
            "post": {
                "tags": [
                    "Autenticação"
                ],
                "operationId": "segundoFator",
                "security": [],
                "summary": "Sign in (step 2: authenticator or recovery code)",
                "description": "On first setup it also returns codigos_recuperacao (show only once).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "desafio": {
                                        "type": "string"
                                    },
                                    "codigo": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "desafio",
                                    "codigo"
                                ]
                            },
                            "example": {
                                "desafio": "Zk3…",
                                "codigo": "492817"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "description": "Next step (sigilo) or tokens"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/auth/clinica": {
            "post": {
                "tags": [
                    "Escudo de entrada"
                ],
                "operationId": "escolherClinicaEntrada",
                "security": [],
                "summary": "Sign in: choose the clinic (email with accounts in several)",
                "description": "When /auth/entrar answers {estado:\"clinica\", desafio, clinicas:[…]}, send the challenge and the chosen clinic id. It continues with that account’s second factor and confidentiality agreement (same responses as /auth/entrar). Only accounts with the same password are listed; suspended licence → 403 licenca_suspensa.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "desafio": {
                                        "type": "string"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dispositivo": {
                                        "type": "string"
                                    },
                                    "plataforma": {
                                        "type": "string"
                                    },
                                    "dispositivo_confiavel": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "desafio",
                                    "clinica_id"
                                ]
                            },
                            "example": {
                                "desafio": "Zk3…",
                                "clinica_id": 4
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "description": "Next step (2fa, sigilo) or tokens"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "estado": "2fa",
                                        "desafio": "Qm8…",
                                        "expira_em": "2026-10-28T10:25:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/auth/desafio": {
            "post": {
                "tags": [
                    "Escudo de entrada"
                ],
                "operationId": "desafioEscudoEquipa",
                "security": [],
                "summary": "Device verification challenge (team)",
                "description": "Stateless (signed), valid for 300 s in the app, single use. With dispositivo_confiavel the verification is one level lighter. dados is null when the shield is off. Limited to 30 requests per minute per address.",
                "x-anagen-modulo": null,
                "x-anagen-nivel": null,
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "dispositivo_confiavel": {
                                        "type": "string"
                                    },
                                    "area": {
                                        "type": "string",
                                        "enum": [
                                            "equipa",
                                            "portal"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "dispositivo_confiavel": "eyJ2IjoxLCJk….a91f…"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "desafio": {
                                                    "type": "string"
                                                },
                                                "salt": {
                                                    "type": "string",
                                                    "pattern": "^[0-9a-f]{32}$"
                                                },
                                                "bits": {
                                                    "type": "integer"
                                                },
                                                "nivel": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 4
                                                },
                                                "valido_por": {
                                                    "type": "integer"
                                                },
                                                "minimo_ms": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "desafio": "eyJ2IjoxLCJpZCI6….9f2c…",
                                        "salt": "3f8a1c0e9b7d4a2f6e5c1b0a9d8e7f60",
                                        "bits": 17,
                                        "nivel": 0,
                                        "valido_por": 300,
                                        "minimo_ms": 0
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/auth/entrar": {
            "post": {
                "tags": [
                    "Autenticação"
                ],
                "operationId": "entrar",
                "security": [],
                "summary": "Sign in (step 1: email and password)",
                "description": "Returns the next step: {estado:\"2fa\", desafio} (with configurar:true, segredo and otpauth when the second factor is not set up yet), {estado:\"sigilo\", desafio, termo} or, once complete, the tokens. The challenge is valid for 10 minutes and 5 attempts.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "palavra_passe": {
                                        "type": "string"
                                    },
                                    "dispositivo": {
                                        "type": "string"
                                    },
                                    "plataforma": {
                                        "type": "string",
                                        "enum": [
                                            "android",
                                            "ios",
                                            "web",
                                            "outro"
                                        ]
                                    }
                                },
                                "required": [
                                    "email",
                                    "palavra_passe"
                                ]
                            },
                            "example": {
                                "email": "ines@clinica.pt",
                                "palavra_passe": "••••••••••••",
                                "dispositivo": "Pixel 9",
                                "plataforma": "android"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "oneOf": [
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "estado": {
                                                            "const": "2fa"
                                                        },
                                                        "desafio": {
                                                            "type": "string"
                                                        },
                                                        "expira_em": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        },
                                                        "configurar": {
                                                            "type": "boolean"
                                                        },
                                                        "segredo": {
                                                            "type": "string"
                                                        },
                                                        "otpauth": {
                                                            "type": "string"
                                                        }
                                                    }
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "estado": {
                                                            "const": "sigilo"
                                                        },
                                                        "desafio": {
                                                            "type": "string"
                                                        },
                                                        "termo": {
                                                            "type": "object",
                                                            "properties": {
                                                                "versao": {
                                                                    "type": "integer"
                                                                },
                                                                "texto": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "acesso": {
                                                            "type": "string"
                                                        },
                                                        "renovacao": {
                                                            "type": "string"
                                                        },
                                                        "expira_em": {
                                                            "type": "string",
                                                            "format": "date-time"
                                                        },
                                                        "renovacao_expira_em": {
                                                            "type": "string",
                                                            "format": "date-time"
                                                        },
                                                        "tipo": {
                                                            "type": "string",
                                                            "enum": [
                                                                "equipa",
                                                                "paciente"
                                                            ]
                                                        },
                                                        "conta": {
                                                            "type": "object"
                                                        },
                                                        "codigos_recuperacao": {
                                                            "type": [
                                                                "array",
                                                                "null"
                                                            ],
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "estado": "2fa",
                                        "desafio": "Zk3…",
                                        "expira_em": "2026-10-28T10:25:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/auth/renovar": {
            "post": {
                "tags": [
                    "Autenticação"
                ],
                "operationId": "renovar",
                "security": [],
                "summary": "Refresh tokens (rotation)",
                "description": "Each refresh returns a new pair and invalidates the previous one. Reusing a refresh token that was already used ends the whole session (family) for safety — the app returns to sign-in.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "renovacao": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "renovacao"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "acesso": {
                                                    "type": "string"
                                                },
                                                "renovacao": {
                                                    "type": "string"
                                                },
                                                "expira_em": {
                                                    "type": "string",
                                                    "format": "date-time"
                                                },
                                                "renovacao_expira_em": {
                                                    "type": "string",
                                                    "format": "date-time"
                                                },
                                                "tipo": {
                                                    "type": "string",
                                                    "enum": [
                                                        "equipa",
                                                        "paciente"
                                                    ]
                                                },
                                                "conta": {
                                                    "type": "object"
                                                },
                                                "codigos_recuperacao": {
                                                    "type": [
                                                        "array",
                                                        "null"
                                                    ],
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "acesso": "ax_a_3M1q…",
                                        "renovacao": "ax_r_Qp9w…",
                                        "expira_em": "2026-10-28T10:35:00+00:00",
                                        "tipo": "equipa",
                                        "conta": {
                                            "id": 7,
                                            "nome": "Inês Valente",
                                            "email": "ines@clinica.pt",
                                            "perfil": "medico",
                                            "clinica": 1
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/auth/sair": {
            "post": {
                "tags": [
                    "Autenticação"
                ],
                "operationId": "sair",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    },
                    {
                        "integracao": []
                    }
                ],
                "summary": "Sign out",
                "description": "Ends the current session; with {todas:true} ends every session of the account (web and app).",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "todas": {
                                        "type": "boolean"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "todas": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/auth/sigilo": {
            "post": {
                "tags": [
                    "Autenticação"
                ],
                "operationId": "aceitarSigilo",
                "security": [],
                "summary": "Sign in (step 3: accept the confidentiality term)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "desafio": {
                                        "type": "string"
                                    },
                                    "aceitar": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "desafio",
                                    "aceitar"
                                ]
                            },
                            "example": {
                                "desafio": "Zk3…",
                                "aceitar": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "acesso": {
                                                    "type": "string"
                                                },
                                                "renovacao": {
                                                    "type": "string"
                                                },
                                                "expira_em": {
                                                    "type": "string",
                                                    "format": "date-time"
                                                },
                                                "renovacao_expira_em": {
                                                    "type": "string",
                                                    "format": "date-time"
                                                },
                                                "tipo": {
                                                    "type": "string",
                                                    "enum": [
                                                        "equipa",
                                                        "paciente"
                                                    ]
                                                },
                                                "conta": {
                                                    "type": "object"
                                                },
                                                "codigos_recuperacao": {
                                                    "type": [
                                                        "array",
                                                        "null"
                                                    ],
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "acesso": "ax_a_3M1q…",
                                        "renovacao": "ax_r_Qp9w…",
                                        "expira_em": "2026-10-28T10:35:00+00:00",
                                        "tipo": "equipa",
                                        "conta": {
                                            "id": 7,
                                            "nome": "Inês Valente",
                                            "email": "ines@clinica.pt",
                                            "perfil": "medico",
                                            "clinica": 1
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bi/tokens": {
            "get": {
                "tags": [
                    "Exportação"
                ],
                "operationId": "listarTokensBi",
                "summary": "My BI tokens",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/TokenBi"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "tags": [
                    "Exportação"
                ],
                "operationId": "criarTokenBi",
                "summary": "Create a BI read token",
                "description": "The token (axbi_…) is only returned in this response. Use it on GET /bi/<set>.csv|json at the site root, with «Authorization: Bearer» or «?token=», and it reads with the person's CURRENT permissions.",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "nome",
                                    "conjuntos"
                                ],
                                "properties": {
                                    "nome": {
                                        "type": "string",
                                        "maxLength": 120
                                    },
                                    "conjuntos": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "enum": [
                                                "indicadores_financeiros",
                                                "indicadores_vendas",
                                                "indicadores_operacionais",
                                                "indicadores_atendimento",
                                                "tarefas"
                                            ]
                                        }
                                    },
                                    "dias": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 730,
                                        "default": 365
                                    }
                                }
                            },
                            "example": {
                                "nome": "Painel da direção",
                                "conjuntos": [
                                    "indicadores_vendas",
                                    "indicadores_financeiros"
                                ],
                                "dias": 365
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "token": {
                                                    "type": "string"
                                                },
                                                "prefixo": {
                                                    "type": "string"
                                                },
                                                "segredo_visivel_uma_vez": {
                                                    "type": "string"
                                                },
                                                "endereco": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 3,
                                        "token": "axbi_4f…",
                                        "prefixo": "axbi_4f1c2a",
                                        "segredo_visivel_uma_vez": "axbi_4f…",
                                        "endereco": "https://anagen.pt/bi"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/bi/tokens/{id}": {
            "delete": {
                "tags": [
                    "Exportação"
                ],
                "operationId": "revogarTokenBi",
                "summary": "Revoke BI token",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/bloco/checklists/{id}/itens": {
            "post": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6MarcarItemChecklist",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Checklist identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Tick or untick a checklist item",
                "description": "Requires «bloco.registo» edit (pre-operative checklists also accept «bloco.marcar» edit). Records who and when; the checklist completes when every mandatory item is done and reopens if one is unticked; the pre-operative one feeds the map «checklist» indicator. Completed or cancelled surgery → 409. Missing index → 422. Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "indice": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "description": "Item position (starting at 0)."
                                    },
                                    "feito": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "indice",
                                    "feito"
                                ]
                            },
                            "example": {
                                "indice": 1,
                                "feito": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Checklist"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 611,
                                        "nome": "Verificação de segurança antes da cirurgia",
                                        "fase": "pre_operatorio",
                                        "fase_rotulo": "Pré-operatório",
                                        "estado": "aberta",
                                        "itens": [
                                            {
                                                "texto": "Identidade do paciente confirmada",
                                                "responsavel_papel": "enfermeiro",
                                                "obrigatorio": true,
                                                "feito": true,
                                                "feito_por": 19,
                                                "feito_por_nome": "Paulo Matos",
                                                "feito_em": "2026-11-17T16:20:00+00:00"
                                            },
                                            {
                                                "texto": "Análises pré-operatórias revistas",
                                                "responsavel_papel": "cirurgiao",
                                                "obrigatorio": true,
                                                "feito": false,
                                                "feito_por": null,
                                                "feito_por_nome": null,
                                                "feito_em": null
                                            },
                                            {
                                                "texto": "Fotografias pré-operatórias tiradas",
                                                "responsavel_papel": "tecnico",
                                                "obrigatorio": false,
                                                "feito": false,
                                                "feito_por": null,
                                                "feito_por_nome": null,
                                                "feito_em": null
                                            }
                                        ],
                                        "feitos": 1,
                                        "total": 3,
                                        "concluida_em": null
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "A sessão já está fechada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/cirurgias": {
            "post": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6CriarCirurgia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.marcar",
                "x-anagen-nivel": "editar",
                "summary": "Create a surgery manually",
                "description": "For surgeries without a proposal (for example an already paid second session): it stays pre-booked, with its own number and fitness «to assess». The act value is only accepted from users with «financeiro.valores» edit. With «inicio» and «sala_id» it reserves the day and room at once (rules of POST /bloco/cirurgias/{id}/reservar); if the reservation fails due to a conflict, the surgery stays created as pre-booked (see GET /bloco/por-agendar) and the request returns 409. Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "tecnica": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "FUE",
                                            "FUT",
                                            "DHI",
                                            "outra",
                                            null
                                        ]
                                    },
                                    "enxertos_planeados": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "maximum": 10000,
                                        "x-unidade": "enxertos"
                                    },
                                    "valor_ato": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "x-moeda": "EUR",
                                        "description": "Act value (only with «financeiro.valores» edit)."
                                    },
                                    "inicio": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "Reserve right away at this start."
                                    },
                                    "sala_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Room for the immediate reservation."
                                    },
                                    "forcar": {
                                        "type": "boolean",
                                        "description": "Accept the warnings (conflito_aviso: holiday, outside working hours, no working hours, past date). Never overrides blocking conflicts."
                                    }
                                },
                                "required": [
                                    "paciente_id"
                                ]
                            },
                            "example": {
                                "paciente_id": 1204,
                                "episodio_id": 77,
                                "tecnica": "FUE",
                                "enxertos_planeados": 2850,
                                "inicio": "2026-11-18T08:30:00+00:00",
                                "sala_id": 5
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Cirurgia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "numero": "CIR-2026-0214",
                                        "estado": "reservada",
                                        "estado_rotulo": "Reservada",
                                        "estado_tom": "ouro",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "episodio_id": 77,
                                        "proposta_id": null,
                                        "plano_id": null,
                                        "marcacao_id": 8902,
                                        "sala_id": 5,
                                        "sala_nome": "Bloco 1",
                                        "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                        "fim_previsto": "2026-11-18T14:30:00+00:00",
                                        "tecnica": "FUE",
                                        "enxertos_planeados": 2850,
                                        "aptidao": "por_avaliar",
                                        "aptidao_rotulo": "Por avaliar",
                                        "validada_por": null,
                                        "validada_em": null,
                                        "confirmada_em": null,
                                        "indicadores": [
                                            {
                                                "chave": "confirmada",
                                                "rotulo": "Confirmada",
                                                "ok": false
                                            },
                                            {
                                                "chave": "sinal",
                                                "rotulo": "Sinal pago",
                                                "ok": true
                                            },
                                            {
                                                "chave": "consentimento",
                                                "rotulo": "Consentimento",
                                                "ok": true
                                            },
                                            {
                                                "chave": "analises",
                                                "rotulo": "Análises",
                                                "ok": true
                                            },
                                            {
                                                "chave": "checklist",
                                                "rotulo": "Checklist",
                                                "ok": false
                                            }
                                        ],
                                        "equipa": [],
                                        "valor_ato": null,
                                        "valores_visiveis": true,
                                        "enxertos_extraidos": null,
                                        "enxertos_implantados": null,
                                        "cabelos_total": null,
                                        "fechada_em": null,
                                        "motivo_cancelamento": null,
                                        "acoes": [
                                            "reservar",
                                            "equipa",
                                            "aptidao",
                                            "confirmar",
                                            "analises",
                                            "cancelar",
                                            "checklist"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (conflito, conflito_aviso, estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "conflito": {
                                        "summary": "conflito",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito",
                                                "mensagem": "Há conflitos na agenda.",
                                                "campos": {
                                                    "participantes": "Marta Sousa já tem uma marcação das 09:00–13:00.",
                                                    "sala_id": "Bloco 1 está ocupada (a partir das 08:30)."
                                                }
                                            }
                                        }
                                    },
                                    "conflito_aviso": {
                                        "summary": "conflito_aviso",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito_aviso",
                                                "mensagem": "Há avisos na agenda. Confirme para continuar.",
                                                "campos": {
                                                    "inicio": "A data já passou."
                                                }
                                            }
                                        }
                                    },
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Esta cirurgia já não pode ser mudada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/cirurgias/{id}": {
            "get": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6ObterCirurgia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "bloco.mapa",
                "x-anagen-nivel": "ver",
                "summary": "Surgery detail",
                "description": "Status, planned times, room, technique, planned grafts, fitness, validation, indicators, team, pre-operative checklists and the actions available to the caller. Per-profile view: the act value is only returned with «financeiro.valores» (scope «all», or on surgeries where the person takes part or made the reservation); each person fees are only returned with scope «all» (otherwise only their own). The read is audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Cirurgia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "numero": "CIR-2026-0214",
                                        "estado": "validada",
                                        "estado_rotulo": "Validada",
                                        "estado_tom": "info",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "episodio_id": 77,
                                        "proposta_id": 91,
                                        "plano_id": 318,
                                        "marcacao_id": 8902,
                                        "sala_id": 5,
                                        "sala_nome": "Bloco 1",
                                        "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                        "fim_previsto": "2026-11-18T14:30:00+00:00",
                                        "tecnica": "FUE",
                                        "enxertos_planeados": 2850,
                                        "aptidao": "apto",
                                        "aptidao_rotulo": "Apto",
                                        "validada_por": "Inês Valente",
                                        "validada_em": "2026-10-28T11:05:00+00:00",
                                        "confirmada_em": null,
                                        "indicadores": [
                                            {
                                                "chave": "confirmada",
                                                "rotulo": "Confirmada",
                                                "ok": false
                                            },
                                            {
                                                "chave": "sinal",
                                                "rotulo": "Sinal pago",
                                                "ok": true
                                            },
                                            {
                                                "chave": "consentimento",
                                                "rotulo": "Consentimento",
                                                "ok": true
                                            },
                                            {
                                                "chave": "analises",
                                                "rotulo": "Análises",
                                                "ok": true
                                            },
                                            {
                                                "chave": "checklist",
                                                "rotulo": "Checklist",
                                                "ok": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "valor_ato": 5900,
                                        "valores_visiveis": true,
                                        "enxertos_extraidos": null,
                                        "enxertos_implantados": null,
                                        "cabelos_total": null,
                                        "fechada_em": null,
                                        "motivo_cancelamento": null,
                                        "acoes": [
                                            "reservar",
                                            "equipa",
                                            "aptidao",
                                            "confirmar",
                                            "analises",
                                            "cancelar",
                                            "checklist"
                                        ],
                                        "checklists": [
                                            {
                                                "id": 611,
                                                "nome": "Verificação de segurança antes da cirurgia",
                                                "fase": "pre_operatorio",
                                                "fase_rotulo": "Pré-operatório",
                                                "estado": "aberta",
                                                "itens": [
                                                    {
                                                        "texto": "Identidade do paciente confirmada",
                                                        "responsavel_papel": "enfermeiro",
                                                        "obrigatorio": true,
                                                        "feito": true,
                                                        "feito_por": 19,
                                                        "feito_por_nome": "Paulo Matos",
                                                        "feito_em": "2026-11-17T16:20:00+00:00"
                                                    },
                                                    {
                                                        "texto": "Análises pré-operatórias revistas",
                                                        "responsavel_papel": "cirurgiao",
                                                        "obrigatorio": true,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    },
                                                    {
                                                        "texto": "Fotografias pré-operatórias tiradas",
                                                        "responsavel_papel": "tecnico",
                                                        "obrigatorio": false,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    }
                                                ],
                                                "feitos": 1,
                                                "total": 3,
                                                "concluida_em": null
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/cirurgias/{id}/analises": {
            "post": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6AnalisesCirurgia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.marcar",
                "x-anagen-nivel": "editar",
                "summary": "Pre-operative tests received",
                "description": "Turns the «tests» indicator on or off. Requires «bloco.marcar» edit or «bloco.registo» edit. Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "ok": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "ok"
                                ]
                            },
                            "example": {
                                "ok": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Cirurgia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "numero": "CIR-2026-0214",
                                        "estado": "validada",
                                        "estado_rotulo": "Validada",
                                        "estado_tom": "info",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "episodio_id": 77,
                                        "proposta_id": 91,
                                        "plano_id": 318,
                                        "marcacao_id": 8902,
                                        "sala_id": 5,
                                        "sala_nome": "Bloco 1",
                                        "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                        "fim_previsto": "2026-11-18T14:30:00+00:00",
                                        "tecnica": "FUE",
                                        "enxertos_planeados": 2850,
                                        "aptidao": "apto",
                                        "aptidao_rotulo": "Apto",
                                        "validada_por": "Inês Valente",
                                        "validada_em": "2026-10-28T11:05:00+00:00",
                                        "confirmada_em": null,
                                        "indicadores": [
                                            {
                                                "chave": "confirmada",
                                                "rotulo": "Confirmada",
                                                "ok": false
                                            },
                                            {
                                                "chave": "sinal",
                                                "rotulo": "Sinal pago",
                                                "ok": true
                                            },
                                            {
                                                "chave": "consentimento",
                                                "rotulo": "Consentimento",
                                                "ok": true
                                            },
                                            {
                                                "chave": "analises",
                                                "rotulo": "Análises",
                                                "ok": true
                                            },
                                            {
                                                "chave": "checklist",
                                                "rotulo": "Checklist",
                                                "ok": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "valor_ato": 5900,
                                        "valores_visiveis": true,
                                        "enxertos_extraidos": null,
                                        "enxertos_implantados": null,
                                        "cabelos_total": null,
                                        "fechada_em": null,
                                        "motivo_cancelamento": null,
                                        "acoes": [
                                            "reservar",
                                            "equipa",
                                            "aptidao",
                                            "confirmar",
                                            "analises",
                                            "cancelar",
                                            "checklist"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/cirurgias/{id}/aptidao": {
            "post": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6AptidaoCirurgia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.marcar",
                "x-anagen-nivel": "aprovar",
                "summary": "Pre-operative fitness (medical decision)",
                "description": "Requires «approve» on «bloco.marcar». A fitness other than «apto» on a validated or confirmed surgery returns it to «reserved» and notifies the validator. Effects: «approve» audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "aptidao": {
                                        "type": "string",
                                        "enum": [
                                            "por_avaliar",
                                            "apto",
                                            "nao_apto"
                                        ]
                                    }
                                },
                                "required": [
                                    "aptidao"
                                ]
                            },
                            "example": {
                                "aptidao": "apto"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Cirurgia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "numero": "CIR-2026-0214",
                                        "estado": "validada",
                                        "estado_rotulo": "Validada",
                                        "estado_tom": "info",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "episodio_id": 77,
                                        "proposta_id": 91,
                                        "plano_id": 318,
                                        "marcacao_id": 8902,
                                        "sala_id": 5,
                                        "sala_nome": "Bloco 1",
                                        "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                        "fim_previsto": "2026-11-18T14:30:00+00:00",
                                        "tecnica": "FUE",
                                        "enxertos_planeados": 2850,
                                        "aptidao": "apto",
                                        "aptidao_rotulo": "Apto",
                                        "validada_por": "Inês Valente",
                                        "validada_em": "2026-10-28T11:05:00+00:00",
                                        "confirmada_em": null,
                                        "indicadores": [
                                            {
                                                "chave": "confirmada",
                                                "rotulo": "Confirmada",
                                                "ok": false
                                            },
                                            {
                                                "chave": "sinal",
                                                "rotulo": "Sinal pago",
                                                "ok": true
                                            },
                                            {
                                                "chave": "consentimento",
                                                "rotulo": "Consentimento",
                                                "ok": true
                                            },
                                            {
                                                "chave": "analises",
                                                "rotulo": "Análises",
                                                "ok": true
                                            },
                                            {
                                                "chave": "checklist",
                                                "rotulo": "Checklist",
                                                "ok": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "valor_ato": 5900,
                                        "valores_visiveis": true,
                                        "enxertos_extraidos": null,
                                        "enxertos_implantados": null,
                                        "cabelos_total": null,
                                        "fechada_em": null,
                                        "motivo_cancelamento": null,
                                        "acoes": [
                                            "reservar",
                                            "equipa",
                                            "aptidao",
                                            "confirmar",
                                            "analises",
                                            "cancelar",
                                            "checklist"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/cirurgias/{id}/cancelar": {
            "post": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6CancelarCirurgia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.marcar",
                "x-anagen-nivel": "editar",
                "summary": "Cancel the surgery",
                "description": "Only in plannable statuses (409). Reason required (up to 255 characters). Also cancels the calendar block and notifies the team with the reason. Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 255
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            },
                            "example": {
                                "motivo": "Paciente pediu para adiar por motivos profissionais."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Cirurgia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "numero": "CIR-2026-0214",
                                        "estado": "cancelada",
                                        "estado_rotulo": "Cancelada",
                                        "estado_tom": "perigo",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "episodio_id": 77,
                                        "proposta_id": 91,
                                        "plano_id": 318,
                                        "marcacao_id": 8902,
                                        "sala_id": 5,
                                        "sala_nome": "Bloco 1",
                                        "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                        "fim_previsto": "2026-11-18T14:30:00+00:00",
                                        "tecnica": "FUE",
                                        "enxertos_planeados": 2850,
                                        "aptidao": "apto",
                                        "aptidao_rotulo": "Apto",
                                        "validada_por": "Inês Valente",
                                        "validada_em": "2026-10-28T11:05:00+00:00",
                                        "confirmada_em": null,
                                        "indicadores": [
                                            {
                                                "chave": "confirmada",
                                                "rotulo": "Confirmada",
                                                "ok": false
                                            },
                                            {
                                                "chave": "sinal",
                                                "rotulo": "Sinal pago",
                                                "ok": true
                                            },
                                            {
                                                "chave": "consentimento",
                                                "rotulo": "Consentimento",
                                                "ok": true
                                            },
                                            {
                                                "chave": "analises",
                                                "rotulo": "Análises",
                                                "ok": true
                                            },
                                            {
                                                "chave": "checklist",
                                                "rotulo": "Checklist",
                                                "ok": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "valor_ato": 5900,
                                        "valores_visiveis": true,
                                        "enxertos_extraidos": null,
                                        "enxertos_implantados": null,
                                        "cabelos_total": null,
                                        "fechada_em": null,
                                        "motivo_cancelamento": "Paciente pediu para adiar por motivos profissionais.",
                                        "acoes": []
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Esta cirurgia já não pode ser mudada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/cirurgias/{id}/checklist": {
            "post": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6ChecklistPreOperatoria",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.mapa",
                "x-anagen-nivel": "ver",
                "summary": "Create the pre-operative checklists",
                "description": "Creates (only once) the checklists of the active templates of the «pre-operative» phase (surgical safety checklist). The action is offered in M6Cirurgia.acoes to those who record in the theatre or view surgical bookings. Returns the ids and the updated detail.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ids": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "cirurgia": {
                                                    "$ref": "#/components/schemas/M6Cirurgia"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ids": [
                                            611
                                        ],
                                        "cirurgia": {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "estado": "validada",
                                            "estado_rotulo": "Validada",
                                            "estado_tom": "info",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "episodio_id": 77,
                                            "proposta_id": 91,
                                            "plano_id": 318,
                                            "marcacao_id": 8902,
                                            "sala_id": 5,
                                            "sala_nome": "Bloco 1",
                                            "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                            "fim_previsto": "2026-11-18T14:30:00+00:00",
                                            "tecnica": "FUE",
                                            "enxertos_planeados": 2850,
                                            "aptidao": "apto",
                                            "aptidao_rotulo": "Apto",
                                            "validada_por": "Inês Valente",
                                            "validada_em": "2026-10-28T11:05:00+00:00",
                                            "confirmada_em": null,
                                            "indicadores": [
                                                {
                                                    "chave": "confirmada",
                                                    "rotulo": "Confirmada",
                                                    "ok": false
                                                },
                                                {
                                                    "chave": "sinal",
                                                    "rotulo": "Sinal pago",
                                                    "ok": true
                                                },
                                                {
                                                    "chave": "consentimento",
                                                    "rotulo": "Consentimento",
                                                    "ok": true
                                                },
                                                {
                                                    "chave": "analises",
                                                    "rotulo": "Análises",
                                                    "ok": true
                                                },
                                                {
                                                    "chave": "checklist",
                                                    "rotulo": "Checklist",
                                                    "ok": false
                                                }
                                            ],
                                            "equipa": [
                                                {
                                                    "utilizador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "papel": "cirurgiao",
                                                    "papel_rotulo": "Cirurgião",
                                                    "honorarios_valor": 1200
                                                },
                                                {
                                                    "utilizador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "papel": "assistente",
                                                    "papel_rotulo": "Assistente"
                                                },
                                                {
                                                    "utilizador_id": 19,
                                                    "nome": "Paulo Matos",
                                                    "cor": "#3A7BC0",
                                                    "papel": "enfermeiro",
                                                    "papel_rotulo": "Enfermeiro"
                                                }
                                            ],
                                            "valor_ato": 5900,
                                            "valores_visiveis": true,
                                            "enxertos_extraidos": null,
                                            "enxertos_implantados": null,
                                            "cabelos_total": null,
                                            "fechada_em": null,
                                            "motivo_cancelamento": null,
                                            "acoes": [
                                                "reservar",
                                                "equipa",
                                                "aptidao",
                                                "confirmar",
                                                "analises",
                                                "cancelar",
                                                "checklist"
                                            ],
                                            "checklists": [
                                                {
                                                    "id": 611,
                                                    "nome": "Verificação de segurança antes da cirurgia",
                                                    "fase": "pre_operatorio",
                                                    "fase_rotulo": "Pré-operatório",
                                                    "estado": "aberta",
                                                    "itens": [
                                                        {
                                                            "texto": "Identidade do paciente confirmada",
                                                            "responsavel_papel": "enfermeiro",
                                                            "obrigatorio": true,
                                                            "feito": true,
                                                            "feito_por": 19,
                                                            "feito_por_nome": "Paulo Matos",
                                                            "feito_em": "2026-11-17T16:20:00+00:00"
                                                        },
                                                        {
                                                            "texto": "Análises pré-operatórias revistas",
                                                            "responsavel_papel": "cirurgiao",
                                                            "obrigatorio": true,
                                                            "feito": false,
                                                            "feito_por": null,
                                                            "feito_por_nome": null,
                                                            "feito_em": null
                                                        },
                                                        {
                                                            "texto": "Fotografias pré-operatórias tiradas",
                                                            "responsavel_papel": "tecnico",
                                                            "obrigatorio": false,
                                                            "feito": false,
                                                            "feito_por": null,
                                                            "feito_por_nome": null,
                                                            "feito_em": null
                                                        }
                                                    ],
                                                    "feitos": 1,
                                                    "total": 3,
                                                    "concluida_em": null
                                                }
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/cirurgias/{id}/confirmar": {
            "post": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6ConfirmarCirurgia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.marcar",
                "x-anagen-nivel": "editar",
                "summary": "Confirm the surgery",
                "description": "Only from «validated» (409). Does not confirm without a valid surgical consent (checked in the compliance module when it exists; otherwise the latest core «cirurgico» consent) — 422 «consentimento_em_falta» — nor without fitness «apto» — 422 «aptidao_em_falta». Effects: calendar block confirmed, episode → «pre-operative», clinical timeline event, team notification and audit.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Cirurgia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "numero": "CIR-2026-0214",
                                        "estado": "confirmada",
                                        "estado_rotulo": "Confirmada",
                                        "estado_tom": "sucesso",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "episodio_id": 77,
                                        "proposta_id": 91,
                                        "plano_id": 318,
                                        "marcacao_id": 8902,
                                        "sala_id": 5,
                                        "sala_nome": "Bloco 1",
                                        "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                        "fim_previsto": "2026-11-18T14:30:00+00:00",
                                        "tecnica": "FUE",
                                        "enxertos_planeados": 2850,
                                        "aptidao": "apto",
                                        "aptidao_rotulo": "Apto",
                                        "validada_por": "Inês Valente",
                                        "validada_em": "2026-10-28T11:05:00+00:00",
                                        "confirmada_em": "2026-10-29T09:30:00+00:00",
                                        "indicadores": [
                                            {
                                                "chave": "confirmada",
                                                "rotulo": "Confirmada",
                                                "ok": true
                                            },
                                            {
                                                "chave": "sinal",
                                                "rotulo": "Sinal pago",
                                                "ok": true
                                            },
                                            {
                                                "chave": "consentimento",
                                                "rotulo": "Consentimento",
                                                "ok": true
                                            },
                                            {
                                                "chave": "analises",
                                                "rotulo": "Análises",
                                                "ok": true
                                            },
                                            {
                                                "chave": "checklist",
                                                "rotulo": "Checklist",
                                                "ok": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "valor_ato": 5900,
                                        "valores_visiveis": true,
                                        "enxertos_extraidos": null,
                                        "enxertos_implantados": null,
                                        "cabelos_total": null,
                                        "fechada_em": null,
                                        "motivo_cancelamento": null,
                                        "acoes": [
                                            "reservar",
                                            "equipa",
                                            "aptidao",
                                            "analises",
                                            "cancelar",
                                            "painel",
                                            "checklist"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Só uma cirurgia validada pode ser confirmada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Business rule (consentimento_em_falta, aptidao_em_falta)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "consentimento_em_falta": {
                                        "summary": "consentimento_em_falta",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "consentimento_em_falta",
                                                "mensagem": "Sem consentimento cirúrgico válido.",
                                                "campos": {
                                                    "consentimento": "Sem consentimento cirúrgico válido."
                                                }
                                            }
                                        }
                                    },
                                    "aptidao_em_falta": {
                                        "summary": "aptidao_em_falta",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "aptidao_em_falta",
                                                "mensagem": "A aptidão pré-operatória tem de ser «apto».",
                                                "campos": {
                                                    "aptidao": "A aptidão pré-operatória tem de ser «apto»."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/cirurgias/{id}/equipa": {
            "post": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6EquipaCirurgia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.marcar",
                "x-anagen-nivel": "editar",
                "summary": "Assign a person to the team (or change the role)",
                "description": "When the surgery has a date, checks whether the person is busy or absent (409 «conflito»; warnings such as «no working hours» are accepted with \"forcar\": true). On a validated or confirmed surgery it returns to «reserved» and the validator is notified. Updates the calendar block participants and notifies the person (when not the one assigning). Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "utilizador_id": {
                                        "type": "integer"
                                    },
                                    "papel": {
                                        "type": "string",
                                        "enum": [
                                            "cirurgiao",
                                            "assistente",
                                            "enfermeiro",
                                            "tecnico",
                                            "anestesista"
                                        ]
                                    },
                                    "forcar": {
                                        "type": "boolean",
                                        "description": "Accept the warnings (conflito_aviso: holiday, outside working hours, no working hours, past date). Never overrides blocking conflicts."
                                    }
                                },
                                "required": [
                                    "utilizador_id",
                                    "papel"
                                ]
                            },
                            "example": {
                                "utilizador_id": 19,
                                "papel": "enfermeiro"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Cirurgia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "numero": "CIR-2026-0214",
                                        "estado": "validada",
                                        "estado_rotulo": "Validada",
                                        "estado_tom": "info",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "episodio_id": 77,
                                        "proposta_id": 91,
                                        "plano_id": 318,
                                        "marcacao_id": 8902,
                                        "sala_id": 5,
                                        "sala_nome": "Bloco 1",
                                        "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                        "fim_previsto": "2026-11-18T14:30:00+00:00",
                                        "tecnica": "FUE",
                                        "enxertos_planeados": 2850,
                                        "aptidao": "apto",
                                        "aptidao_rotulo": "Apto",
                                        "validada_por": "Inês Valente",
                                        "validada_em": "2026-10-28T11:05:00+00:00",
                                        "confirmada_em": null,
                                        "indicadores": [
                                            {
                                                "chave": "confirmada",
                                                "rotulo": "Confirmada",
                                                "ok": false
                                            },
                                            {
                                                "chave": "sinal",
                                                "rotulo": "Sinal pago",
                                                "ok": true
                                            },
                                            {
                                                "chave": "consentimento",
                                                "rotulo": "Consentimento",
                                                "ok": true
                                            },
                                            {
                                                "chave": "analises",
                                                "rotulo": "Análises",
                                                "ok": true
                                            },
                                            {
                                                "chave": "checklist",
                                                "rotulo": "Checklist",
                                                "ok": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "valor_ato": 5900,
                                        "valores_visiveis": true,
                                        "enxertos_extraidos": null,
                                        "enxertos_implantados": null,
                                        "cabelos_total": null,
                                        "fechada_em": null,
                                        "motivo_cancelamento": null,
                                        "acoes": [
                                            "reservar",
                                            "equipa",
                                            "aptidao",
                                            "confirmar",
                                            "analises",
                                            "cancelar",
                                            "checklist"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (conflito, conflito_aviso, estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "conflito": {
                                        "summary": "conflito",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito",
                                                "mensagem": "Há conflitos na agenda.",
                                                "campos": {
                                                    "participantes": "Marta Sousa já tem uma marcação das 09:00–13:00.",
                                                    "sala_id": "Bloco 1 está ocupada (a partir das 08:30)."
                                                }
                                            }
                                        }
                                    },
                                    "conflito_aviso": {
                                        "summary": "conflito_aviso",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito_aviso",
                                                "mensagem": "Há avisos na agenda. Confirme para continuar.",
                                                "campos": {
                                                    "inicio": "A data já passou."
                                                }
                                            }
                                        }
                                    },
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Esta cirurgia já não pode ser mudada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/cirurgias/{id}/reservar": {
            "post": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6ReservarCirurgia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.marcar",
                "x-anagen-nivel": "editar",
                "summary": "Reserve or change the day and room",
                "description": "Only in pre-booked, reserved, validated or confirmed (409 «estado_invalido»). Without «fim», the duration is kept (or the surgery type duration, 360 min by default). Conflicts checked for the surgeon, the team and the room, without working hours (409 «conflito» / «conflito_aviso»; resend with \"forcar\": true). A pre-booked surgery becomes reserved and the episode «scheduled»; changing the day or room of a validated or confirmed surgery returns it to «reserved» (new validation) and notifies the validator. Creates or updates the calendar block (surgery-type appointment, with the team as participants) so that calendar and map share conflicts. Effects: appointment history and audit. Response times are clinic local time, without offset; the updated detail comes in «cirurgia».",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "inicio": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "fim": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time"
                                    },
                                    "sala_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Required when the surgery has no room yet."
                                    },
                                    "forcar": {
                                        "type": "boolean",
                                        "description": "Accept the warnings (conflito_aviso: holiday, outside working hours, no working hours, past date). Never overrides blocking conflicts."
                                    }
                                },
                                "required": [
                                    "inicio"
                                ]
                            },
                            "example": {
                                "inicio": "2026-11-18T08:30:00+00:00",
                                "sala_id": 5,
                                "forcar": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6ResultadoReserva"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "inicio": "2026-11-18T08:30:00",
                                        "fim": "2026-11-18T14:30:00",
                                        "recurso": 5,
                                        "avisos": [],
                                        "mensagem": "Cirurgia reservada.",
                                        "cirurgia": {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "estado": "reservada",
                                            "estado_rotulo": "Reservada",
                                            "estado_tom": "ouro",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "episodio_id": 77,
                                            "proposta_id": 91,
                                            "plano_id": 318,
                                            "marcacao_id": 8902,
                                            "sala_id": 5,
                                            "sala_nome": "Bloco 1",
                                            "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                            "fim_previsto": "2026-11-18T14:30:00+00:00",
                                            "tecnica": "FUE",
                                            "enxertos_planeados": 2850,
                                            "aptidao": "apto",
                                            "aptidao_rotulo": "Apto",
                                            "validada_por": null,
                                            "validada_em": null,
                                            "confirmada_em": null,
                                            "indicadores": [
                                                {
                                                    "chave": "confirmada",
                                                    "rotulo": "Confirmada",
                                                    "ok": false
                                                },
                                                {
                                                    "chave": "sinal",
                                                    "rotulo": "Sinal pago",
                                                    "ok": true
                                                },
                                                {
                                                    "chave": "consentimento",
                                                    "rotulo": "Consentimento",
                                                    "ok": true
                                                },
                                                {
                                                    "chave": "analises",
                                                    "rotulo": "Análises",
                                                    "ok": true
                                                },
                                                {
                                                    "chave": "checklist",
                                                    "rotulo": "Checklist",
                                                    "ok": false
                                                }
                                            ],
                                            "equipa": [
                                                {
                                                    "utilizador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "papel": "cirurgiao",
                                                    "papel_rotulo": "Cirurgião",
                                                    "honorarios_valor": 1200
                                                },
                                                {
                                                    "utilizador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "papel": "assistente",
                                                    "papel_rotulo": "Assistente"
                                                },
                                                {
                                                    "utilizador_id": 19,
                                                    "nome": "Paulo Matos",
                                                    "cor": "#3A7BC0",
                                                    "papel": "enfermeiro",
                                                    "papel_rotulo": "Enfermeiro"
                                                }
                                            ],
                                            "valor_ato": 5900,
                                            "valores_visiveis": true,
                                            "enxertos_extraidos": null,
                                            "enxertos_implantados": null,
                                            "cabelos_total": null,
                                            "fechada_em": null,
                                            "motivo_cancelamento": null,
                                            "acoes": [
                                                "reservar",
                                                "equipa",
                                                "aptidao",
                                                "confirmar",
                                                "analises",
                                                "cancelar",
                                                "checklist"
                                            ],
                                            "checklists": [
                                                {
                                                    "id": 611,
                                                    "nome": "Verificação de segurança antes da cirurgia",
                                                    "fase": "pre_operatorio",
                                                    "fase_rotulo": "Pré-operatório",
                                                    "estado": "aberta",
                                                    "itens": [
                                                        {
                                                            "texto": "Identidade do paciente confirmada",
                                                            "responsavel_papel": "enfermeiro",
                                                            "obrigatorio": true,
                                                            "feito": true,
                                                            "feito_por": 19,
                                                            "feito_por_nome": "Paulo Matos",
                                                            "feito_em": "2026-11-17T16:20:00+00:00"
                                                        },
                                                        {
                                                            "texto": "Análises pré-operatórias revistas",
                                                            "responsavel_papel": "cirurgiao",
                                                            "obrigatorio": true,
                                                            "feito": false,
                                                            "feito_por": null,
                                                            "feito_por_nome": null,
                                                            "feito_em": null
                                                        },
                                                        {
                                                            "texto": "Fotografias pré-operatórias tiradas",
                                                            "responsavel_papel": "tecnico",
                                                            "obrigatorio": false,
                                                            "feito": false,
                                                            "feito_por": null,
                                                            "feito_por_nome": null,
                                                            "feito_em": null
                                                        }
                                                    ],
                                                    "feitos": 1,
                                                    "total": 3,
                                                    "concluida_em": null
                                                }
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (conflito, conflito_aviso, estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "conflito": {
                                        "summary": "conflito",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito",
                                                "mensagem": "Há conflitos na agenda.",
                                                "campos": {
                                                    "participantes": "Marta Sousa já tem uma marcação das 09:00–13:00.",
                                                    "sala_id": "Bloco 1 está ocupada (a partir das 08:30)."
                                                }
                                            }
                                        }
                                    },
                                    "conflito_aviso": {
                                        "summary": "conflito_aviso",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito_aviso",
                                                "mensagem": "Há avisos na agenda. Confirme para continuar.",
                                                "campos": {
                                                    "inicio": "A data já passou."
                                                }
                                            }
                                        }
                                    },
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Esta cirurgia já não pode ser mudada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/cirurgias/{id}/retirar": {
            "post": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6RetirarDaEquipa",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.marcar",
                "x-anagen-nivel": "editar",
                "summary": "Remove a person from the team",
                "description": "Only in plannable statuses (409). On a validated or confirmed surgery it returns to «reserved» and the validator is notified. Updates the calendar block. Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "utilizador_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "utilizador_id"
                                ]
                            },
                            "example": {
                                "utilizador_id": 19
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Cirurgia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "numero": "CIR-2026-0214",
                                        "estado": "validada",
                                        "estado_rotulo": "Validada",
                                        "estado_tom": "info",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "episodio_id": 77,
                                        "proposta_id": 91,
                                        "plano_id": 318,
                                        "marcacao_id": 8902,
                                        "sala_id": 5,
                                        "sala_nome": "Bloco 1",
                                        "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                        "fim_previsto": "2026-11-18T14:30:00+00:00",
                                        "tecnica": "FUE",
                                        "enxertos_planeados": 2850,
                                        "aptidao": "apto",
                                        "aptidao_rotulo": "Apto",
                                        "validada_por": "Inês Valente",
                                        "validada_em": "2026-10-28T11:05:00+00:00",
                                        "confirmada_em": null,
                                        "indicadores": [
                                            {
                                                "chave": "confirmada",
                                                "rotulo": "Confirmada",
                                                "ok": false
                                            },
                                            {
                                                "chave": "sinal",
                                                "rotulo": "Sinal pago",
                                                "ok": true
                                            },
                                            {
                                                "chave": "consentimento",
                                                "rotulo": "Consentimento",
                                                "ok": true
                                            },
                                            {
                                                "chave": "analises",
                                                "rotulo": "Análises",
                                                "ok": true
                                            },
                                            {
                                                "chave": "checklist",
                                                "rotulo": "Checklist",
                                                "ok": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "valor_ato": 5900,
                                        "valores_visiveis": true,
                                        "enxertos_extraidos": null,
                                        "enxertos_implantados": null,
                                        "cabelos_total": null,
                                        "fechada_em": null,
                                        "motivo_cancelamento": null,
                                        "acoes": [
                                            "reservar",
                                            "equipa",
                                            "aptidao",
                                            "confirmar",
                                            "analises",
                                            "cancelar",
                                            "checklist"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Esta cirurgia já não pode ser mudada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/cirurgias/{id}/validar": {
            "post": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6ValidarCirurgia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.marcar",
                "x-anagen-nivel": "aprovar",
                "summary": "Validate team and fitness (doctor)",
                "description": "Requires «approve» on «bloco.marcar». Only from «reserved» (409). Requires date and room, a surgeon on the team and fitness «apto» (422 «validacao» with fields inicio, equipa, aptidao). Effects: «approve» audit and notification to the person who reserved.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Cirurgia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "numero": "CIR-2026-0214",
                                        "estado": "validada",
                                        "estado_rotulo": "Validada",
                                        "estado_tom": "info",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "episodio_id": 77,
                                        "proposta_id": 91,
                                        "plano_id": 318,
                                        "marcacao_id": 8902,
                                        "sala_id": 5,
                                        "sala_nome": "Bloco 1",
                                        "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                        "fim_previsto": "2026-11-18T14:30:00+00:00",
                                        "tecnica": "FUE",
                                        "enxertos_planeados": 2850,
                                        "aptidao": "apto",
                                        "aptidao_rotulo": "Apto",
                                        "validada_por": "Inês Valente",
                                        "validada_em": "2026-10-28T11:05:00+00:00",
                                        "confirmada_em": null,
                                        "indicadores": [
                                            {
                                                "chave": "confirmada",
                                                "rotulo": "Confirmada",
                                                "ok": false
                                            },
                                            {
                                                "chave": "sinal",
                                                "rotulo": "Sinal pago",
                                                "ok": true
                                            },
                                            {
                                                "chave": "consentimento",
                                                "rotulo": "Consentimento",
                                                "ok": true
                                            },
                                            {
                                                "chave": "analises",
                                                "rotulo": "Análises",
                                                "ok": true
                                            },
                                            {
                                                "chave": "checklist",
                                                "rotulo": "Checklist",
                                                "ok": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "valor_ato": 5900,
                                        "valores_visiveis": true,
                                        "enxertos_extraidos": null,
                                        "enxertos_implantados": null,
                                        "cabelos_total": null,
                                        "fechada_em": null,
                                        "motivo_cancelamento": null,
                                        "acoes": [
                                            "reservar",
                                            "equipa",
                                            "aptidao",
                                            "confirmar",
                                            "analises",
                                            "cancelar",
                                            "checklist"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Só uma cirurgia reservada pode ser validada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Business rule (validacao)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "validacao": {
                                        "summary": "validacao",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "validacao",
                                                "mensagem": "Ainda não é possível validar.",
                                                "campos": {
                                                    "equipa": "Falta o cirurgião na equipa.",
                                                    "aptidao": "A aptidão pré-operatória tem de ser «apto»."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/escala": {
            "get": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6EscalaBloco",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "bloco.mapa",
                "x-anagen-nivel": "ver",
                "summary": "Weekly clinical team roster",
                "description": "Week (Monday to Sunday) containing «data»: one row per clinical team member (doctors, nursing, technicians) with each day surgeries (time, room, role, status) and approved absences. People with surgeries that week come first.",
                "parameters": [
                    {
                        "name": "data",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Any day of the wanted week (default today)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Escala"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "dias": [
                                            "2026-11-16",
                                            "2026-11-17",
                                            "2026-11-18",
                                            "2026-11-19",
                                            "2026-11-20",
                                            "2026-11-21",
                                            "2026-11-22"
                                        ],
                                        "linhas": [
                                            {
                                                "utilizador": {
                                                    "id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "perfil": "medico",
                                                    "departamento": "medico"
                                                },
                                                "dias": [
                                                    {
                                                        "data": "2026-11-16",
                                                        "itens": [],
                                                        "ausencia": null
                                                    },
                                                    {
                                                        "data": "2026-11-17",
                                                        "itens": [],
                                                        "ausencia": null
                                                    },
                                                    {
                                                        "data": "2026-11-18",
                                                        "itens": [
                                                            {
                                                                "cirurgia_id": 214,
                                                                "numero": "CIR-2026-0214",
                                                                "hora": "08:30–14:30",
                                                                "sala": "Bloco 1",
                                                                "papel": "Cirurgião",
                                                                "estado": "validada"
                                                            }
                                                        ],
                                                        "ausencia": null
                                                    },
                                                    {
                                                        "data": "2026-11-19",
                                                        "itens": [],
                                                        "ausencia": null
                                                    },
                                                    {
                                                        "data": "2026-11-20",
                                                        "itens": [],
                                                        "ausencia": "Formação"
                                                    },
                                                    {
                                                        "data": "2026-11-21",
                                                        "itens": [],
                                                        "ausencia": null
                                                    },
                                                    {
                                                        "data": "2026-11-22",
                                                        "itens": [],
                                                        "ausencia": null
                                                    }
                                                ],
                                                "total": 1
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/mapa": {
            "get": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6MapaCirurgias",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "bloco.mapa",
                "x-anagen-nivel": "ver",
                "summary": "Surgery map by room",
                "description": "Non-cancelled surgeries dated in the range (up to 500), with the surgeon colour, the room as «recurso», the 5 indicators (confirmed, deposit, consent, tests, checklist) and the team. «utilizador» shows only surgeries where the person is on the team. «editavel» tells whether the caller can change the surgery (bloco.marcar edit and a plannable status).",
                "parameters": [
                    {
                        "name": "inicio",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Start (default today)."
                    },
                    {
                        "name": "fim",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "End (default today + 7 days)."
                    },
                    {
                        "name": "utilizador",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Only surgeries with this person on the team."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M6EventoMapa"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 214,
                                            "titulo": "CIR-2026-0214 · Rui Almeida",
                                            "subtitulo": "Validada · 3/5 · Inês V., Marta S., Paulo M.",
                                            "inicio": "2026-11-18T08:30:00+00:00",
                                            "fim": "2026-11-18T14:30:00+00:00",
                                            "cor": "#7A4E9C",
                                            "recurso": 5,
                                            "url": null,
                                            "editavel": true,
                                            "numero": "CIR-2026-0214",
                                            "estado": "validada",
                                            "estado_rotulo": "Validada",
                                            "estado_tom": "info",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "sala_id": 5,
                                            "tecnica": "FUE",
                                            "enxertos_planeados": 2850,
                                            "indicadores": [
                                                {
                                                    "chave": "confirmada",
                                                    "rotulo": "Confirmada",
                                                    "ok": false
                                                },
                                                {
                                                    "chave": "sinal",
                                                    "rotulo": "Sinal pago",
                                                    "ok": true
                                                },
                                                {
                                                    "chave": "consentimento",
                                                    "rotulo": "Consentimento",
                                                    "ok": true
                                                },
                                                {
                                                    "chave": "analises",
                                                    "rotulo": "Análises",
                                                    "ok": true
                                                },
                                                {
                                                    "chave": "checklist",
                                                    "rotulo": "Checklist",
                                                    "ok": false
                                                }
                                            ],
                                            "indicadores_ok": 3,
                                            "equipa": [
                                                {
                                                    "utilizador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "papel": "cirurgiao"
                                                },
                                                {
                                                    "utilizador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "papel": "assistente"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/ocupacao": {
            "get": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6OcupacaoBloco",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "bloco.mapa",
                "x-anagen-nivel": "ver",
                "summary": "Theatre occupancy by room",
                "description": "Theatre rooms (or every room when none is flagged as theatre): available hours from the room working hours (without hours: Settings › Theatre › hours per weekday, 10 by default), hours used by reserved or later surgeries, percentage and number of surgeries. Default: current week.",
                "parameters": [
                    {
                        "name": "inicio",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Start (default Monday this week)."
                    },
                    {
                        "name": "fim",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "End (default start + 7 days)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M6OcupacaoBloco"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "sala_id": 5,
                                            "sala_nome": "Bloco 1",
                                            "cor": "#8C2F39",
                                            "horas_disponiveis": 50,
                                            "horas_usadas": 36,
                                            "percentagem": 72,
                                            "cirurgias": 6
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel": {
            "get": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelDoDia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "ver",
                "summary": "Surgeries of the day to pick in the panel",
                "description": "Validated, confirmed, in-progress or completed surgeries planned to start on the day, by time, with the current phase and the team.",
                "parameters": [
                    {
                        "name": "data",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Day (default today)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M6CirurgiaDoDia"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "paciente_nome": "Rui Almeida",
                                            "inicio": "2026-11-18T08:30:00+00:00",
                                            "sala_nome": "Bloco 1",
                                            "estado": "em_curso",
                                            "estado_rotulo": "Em curso",
                                            "estado_tom": "marca",
                                            "fase_atual": "implantacao",
                                            "enxertos_planeados": 2850,
                                            "tecnica": "FUE",
                                            "equipa": [
                                                {
                                                    "utilizador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "papel": "cirurgiao",
                                                    "papel_rotulo": "Cirurgião"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}": {
            "get": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelEstado",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "ver",
                "summary": "Full panel state",
                "description": "State synchronised between theatre tablets (poll every few seconds): surgery and timer (without pauses), phases with duration, team and operators, counts by FU type and moment, progress against the plan, batches with time out of body (warning and maximum in Settings › Theatre, 4 h and 6 h by default), transection, approved plan summary (with «ficha.plano» summary), nursing (only with clinical record access; otherwise {visivel:false}), checklists, discharge, permissions and voice-counting words. The first read without «atualizar» records the panel opening in the audit log; periodic refreshes should send atualizar=1.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "name": "atualizar",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "enum": [
                                1
                            ]
                        },
                        "description": "Periodic refresh (does not record a new opening in the audit log)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Painel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "cirurgia": {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "estado": "em_curso",
                                            "estado_rotulo": "Em curso",
                                            "estado_tom": "marca",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "sala_nome": "Bloco 1",
                                            "tecnica": "FUE",
                                            "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                            "inicio_real": "2026-11-18T08:41:00+00:00",
                                            "fim_real": null,
                                            "fase_atual": "implantacao",
                                            "pausada": false,
                                            "pausada_em": null,
                                            "decorrido_seg": 14100,
                                            "peso_kg": 80,
                                            "consentimento": true
                                        },
                                        "fases": [
                                            {
                                                "fase": "admissao",
                                                "rotulo": "Admissão",
                                                "duracao_seg": 900,
                                                "inicio": "2026-11-18T08:41:00+00:00",
                                                "fim": "2026-11-18T08:56:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "desenho",
                                                "rotulo": "Desenho",
                                                "duracao_seg": 1200,
                                                "inicio": "2026-11-18T08:56:00+00:00",
                                                "fim": "2026-11-18T09:16:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "anestesia",
                                                "rotulo": "Anestesia",
                                                "duracao_seg": 600,
                                                "inicio": "2026-11-18T09:16:00+00:00",
                                                "fim": "2026-11-18T09:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "extracao",
                                                "rotulo": "Extração",
                                                "duracao_seg": 6900,
                                                "inicio": "2026-11-18T09:26:00+00:00",
                                                "fim": "2026-11-18T11:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "implantacao",
                                                "rotulo": "Implantação",
                                                "duracao_seg": 4500,
                                                "inicio": "2026-11-18T11:26:00+00:00",
                                                "fim": null,
                                                "atual": true,
                                                "feita": false
                                            },
                                            {
                                                "fase": "penso",
                                                "rotulo": "Penso",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            },
                                            {
                                                "fase": "alta",
                                                "rotulo": "Alta",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "operadores": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 410,
                                                    "2": 1260,
                                                    "3": 820,
                                                    "4": 140
                                                },
                                                "total": 2630,
                                                "cabelos": 5950,
                                                "cabelos_por_enxerto": 2.26
                                            },
                                            "implantacao": {
                                                "por_tipo": {
                                                    "1": 380,
                                                    "2": 1100,
                                                    "3": 700,
                                                    "4": 120
                                                },
                                                "total": 2300,
                                                "cabelos": 5160,
                                                "cabelos_por_enxerto": 2.24
                                            },
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "extracao": 2630,
                                                    "implantacao": 0,
                                                    "por_tipo": {
                                                        "1": 410,
                                                        "2": 1260,
                                                        "3": 820,
                                                        "4": 140
                                                    },
                                                    "por_hora": 780
                                                },
                                                {
                                                    "operador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "extracao": 0,
                                                    "implantacao": 2300,
                                                    "por_tipo": {
                                                        "1": 380,
                                                        "2": 1100,
                                                        "3": 700,
                                                        "4": 120
                                                    },
                                                    "por_hora": 920
                                                }
                                            ]
                                        },
                                        "planeado": 2850,
                                        "progresso": {
                                            "extraido_pct": 92,
                                            "implantado_pct": 81
                                        },
                                        "ultima_contagem": {
                                            "id": 90412,
                                            "tipo_uf": 2,
                                            "momento": "implantacao",
                                            "operador": "Marta Sousa",
                                            "criado_em": "2026-11-18T12:41:09+00:00"
                                        },
                                        "lotes": [
                                            {
                                                "id": 51,
                                                "lote": "L1",
                                                "quantidade": 600,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T09:50:00+00:00",
                                                "implantado_em": "2026-11-18T11:35:00+00:00",
                                                "horas_fora": 1.75,
                                                "estado": "ok"
                                            },
                                            {
                                                "id": 52,
                                                "lote": "L2",
                                                "quantidade": 700,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T10:30:00+00:00",
                                                "implantado_em": null,
                                                "horas_fora": 2.18,
                                                "estado": "ok"
                                            }
                                        ],
                                        "tempo_fora": {
                                            "alerta_h": 4,
                                            "maximo_h": 6
                                        },
                                        "transeccao": {
                                            "sessao_pct": 3.5,
                                            "amostras": 2,
                                            "observados": 200,
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "pct": 3.5,
                                                    "observados": 200
                                                }
                                            ]
                                        },
                                        "plano": {
                                            "id": 318,
                                            "versao": 3,
                                            "tecnica": "FUE",
                                            "enxertos_necessarios": 3200,
                                            "capacidade_sessao": 2850,
                                            "zonas": [
                                                {
                                                    "zona": "linha_frontal",
                                                    "rotulo": "Linha frontal",
                                                    "area_cm2": 15,
                                                    "densidade_alvo": 25,
                                                    "enxertos": 375
                                                },
                                                {
                                                    "zona": "frontal",
                                                    "rotulo": "Frontal",
                                                    "area_cm2": 60,
                                                    "densidade_alvo": 30,
                                                    "enxertos": 1800
                                                }
                                            ]
                                        },
                                        "enfermagem": {
                                            "visivel": true,
                                            "registos": [
                                                {
                                                    "id": 3302,
                                                    "tipo": "sinais_vitais",
                                                    "tipo_rotulo": "Sinais vitais",
                                                    "dados": {
                                                        "tas": 128,
                                                        "tad": 79,
                                                        "fc": 72,
                                                        "spo2": 98
                                                    },
                                                    "texto": "TA 128/79 mmHg · FC 72 bpm · SpO₂ 98 %",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T10:00:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                },
                                                {
                                                    "id": 3301,
                                                    "tipo": "farmaco",
                                                    "tipo_rotulo": "Fármaco",
                                                    "dados": {
                                                        "nome": "Lidocaína com adrenalina",
                                                        "dose": 34,
                                                        "unidade": "ml",
                                                        "concentracao_pct": 1,
                                                        "via": "local",
                                                        "hora": "09:05",
                                                        "lote": "LX2291",
                                                        "adrenalina": true,
                                                        "artigo_id": 58
                                                    },
                                                    "texto": "Lidocaína com adrenalina 34,00 ml (1,0 %) · Local · 09:05 · Lote LX2291 · com adrenalina",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T09:05:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                }
                                            ],
                                            "lidocaina": {
                                                "mg_total": 340,
                                                "mg_kg": 4.25,
                                                "limite": 7,
                                                "com_adrenalina": true,
                                                "aviso_pct": 80,
                                                "percentagem": 61,
                                                "estado": "ok",
                                                "peso_kg": 80
                                            },
                                            "sinais_vitais": {
                                                "ultimo_em": "2026-11-18T10:00:00+00:00",
                                                "intervalo_min": 60,
                                                "em_atraso": false
                                            },
                                            "dor_ultima": 2,
                                            "vias": [
                                                {
                                                    "valor": "local",
                                                    "rotulo": "Local"
                                                },
                                                {
                                                    "valor": "subcutanea",
                                                    "rotulo": "Subcutânea"
                                                },
                                                {
                                                    "valor": "oral",
                                                    "rotulo": "Oral"
                                                }
                                            ],
                                            "unidades": [
                                                "mg",
                                                "ml",
                                                "mcg",
                                                "UI",
                                                "g"
                                            ]
                                        },
                                        "checklists": [
                                            {
                                                "id": 611,
                                                "nome": "Verificação de segurança antes da cirurgia",
                                                "fase": "pre_operatorio",
                                                "fase_rotulo": "Pré-operatório",
                                                "estado": "concluida",
                                                "itens": [
                                                    {
                                                        "texto": "Identidade do paciente confirmada",
                                                        "responsavel_papel": "enfermeiro",
                                                        "obrigatorio": true,
                                                        "feito": true,
                                                        "feito_por": 19,
                                                        "feito_por_nome": "Paulo Matos",
                                                        "feito_em": "2026-11-17T16:20:00+00:00"
                                                    },
                                                    {
                                                        "texto": "Análises pré-operatórias revistas",
                                                        "responsavel_papel": "cirurgiao",
                                                        "obrigatorio": true,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    },
                                                    {
                                                        "texto": "Fotografias pré-operatórias tiradas",
                                                        "responsavel_papel": "tecnico",
                                                        "obrigatorio": false,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    }
                                                ],
                                                "feitos": 3,
                                                "total": 3,
                                                "concluida_em": "2026-11-18T08:20:00+00:00"
                                            }
                                        ],
                                        "alta": null,
                                        "permissoes": {
                                            "registar": true,
                                            "abrir": false,
                                            "fechar": true,
                                            "enfermagem": true
                                        },
                                        "voz_palavras": {
                                            "1": [
                                                "um",
                                                "uma",
                                                "one",
                                                "uno",
                                                "un",
                                                "eins",
                                                "1"
                                            ],
                                            "2": [
                                                "dois",
                                                "duas",
                                                "two",
                                                "dos",
                                                "deux",
                                                "zwei",
                                                "2"
                                            ],
                                            "3": [
                                                "três",
                                                "tres",
                                                "three",
                                                "trois",
                                                "drei",
                                                "3"
                                            ],
                                            "4": [
                                                "quatro",
                                                "four",
                                                "cuatro",
                                                "quatre",
                                                "vier",
                                                "4"
                                            ],
                                            "desfazer": [
                                                "desfazer",
                                                "anular",
                                                "undo",
                                                "deshacer",
                                                "annuler",
                                                "rückgängig"
                                            ]
                                        },
                                        "atualizado_em": "2026-11-18T12:41:12+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/abrir": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelAbrir",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Open the surgical session",
                "description": "Only a confirmed surgery (409 «estado_invalido») and only with a valid surgical consent, checked again at this moment (422 «consentimento_em_falta»). Effects: surgery in progress with real start time and phase «admission», admission checklists created, appointment in progress with check-in, episode → «surgery», clinical timeline event and audit.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Painel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "cirurgia": {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "estado": "em_curso",
                                            "estado_rotulo": "Em curso",
                                            "estado_tom": "marca",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "sala_nome": "Bloco 1",
                                            "tecnica": "FUE",
                                            "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                            "inicio_real": "2026-11-18T08:41:00+00:00",
                                            "fim_real": null,
                                            "fase_atual": "implantacao",
                                            "pausada": false,
                                            "pausada_em": null,
                                            "decorrido_seg": 14100,
                                            "peso_kg": 80,
                                            "consentimento": true
                                        },
                                        "fases": [
                                            {
                                                "fase": "admissao",
                                                "rotulo": "Admissão",
                                                "duracao_seg": 900,
                                                "inicio": "2026-11-18T08:41:00+00:00",
                                                "fim": "2026-11-18T08:56:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "desenho",
                                                "rotulo": "Desenho",
                                                "duracao_seg": 1200,
                                                "inicio": "2026-11-18T08:56:00+00:00",
                                                "fim": "2026-11-18T09:16:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "anestesia",
                                                "rotulo": "Anestesia",
                                                "duracao_seg": 600,
                                                "inicio": "2026-11-18T09:16:00+00:00",
                                                "fim": "2026-11-18T09:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "extracao",
                                                "rotulo": "Extração",
                                                "duracao_seg": 6900,
                                                "inicio": "2026-11-18T09:26:00+00:00",
                                                "fim": "2026-11-18T11:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "implantacao",
                                                "rotulo": "Implantação",
                                                "duracao_seg": 4500,
                                                "inicio": "2026-11-18T11:26:00+00:00",
                                                "fim": null,
                                                "atual": true,
                                                "feita": false
                                            },
                                            {
                                                "fase": "penso",
                                                "rotulo": "Penso",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            },
                                            {
                                                "fase": "alta",
                                                "rotulo": "Alta",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "operadores": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 410,
                                                    "2": 1260,
                                                    "3": 820,
                                                    "4": 140
                                                },
                                                "total": 2630,
                                                "cabelos": 5950,
                                                "cabelos_por_enxerto": 2.26
                                            },
                                            "implantacao": {
                                                "por_tipo": {
                                                    "1": 380,
                                                    "2": 1100,
                                                    "3": 700,
                                                    "4": 120
                                                },
                                                "total": 2300,
                                                "cabelos": 5160,
                                                "cabelos_por_enxerto": 2.24
                                            },
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "extracao": 2630,
                                                    "implantacao": 0,
                                                    "por_tipo": {
                                                        "1": 410,
                                                        "2": 1260,
                                                        "3": 820,
                                                        "4": 140
                                                    },
                                                    "por_hora": 780
                                                },
                                                {
                                                    "operador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "extracao": 0,
                                                    "implantacao": 2300,
                                                    "por_tipo": {
                                                        "1": 380,
                                                        "2": 1100,
                                                        "3": 700,
                                                        "4": 120
                                                    },
                                                    "por_hora": 920
                                                }
                                            ]
                                        },
                                        "planeado": 2850,
                                        "progresso": {
                                            "extraido_pct": 92,
                                            "implantado_pct": 81
                                        },
                                        "ultima_contagem": {
                                            "id": 90412,
                                            "tipo_uf": 2,
                                            "momento": "implantacao",
                                            "operador": "Marta Sousa",
                                            "criado_em": "2026-11-18T12:41:09+00:00"
                                        },
                                        "lotes": [
                                            {
                                                "id": 51,
                                                "lote": "L1",
                                                "quantidade": 600,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T09:50:00+00:00",
                                                "implantado_em": "2026-11-18T11:35:00+00:00",
                                                "horas_fora": 1.75,
                                                "estado": "ok"
                                            },
                                            {
                                                "id": 52,
                                                "lote": "L2",
                                                "quantidade": 700,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T10:30:00+00:00",
                                                "implantado_em": null,
                                                "horas_fora": 2.18,
                                                "estado": "ok"
                                            }
                                        ],
                                        "tempo_fora": {
                                            "alerta_h": 4,
                                            "maximo_h": 6
                                        },
                                        "transeccao": {
                                            "sessao_pct": 3.5,
                                            "amostras": 2,
                                            "observados": 200,
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "pct": 3.5,
                                                    "observados": 200
                                                }
                                            ]
                                        },
                                        "plano": {
                                            "id": 318,
                                            "versao": 3,
                                            "tecnica": "FUE",
                                            "enxertos_necessarios": 3200,
                                            "capacidade_sessao": 2850,
                                            "zonas": [
                                                {
                                                    "zona": "linha_frontal",
                                                    "rotulo": "Linha frontal",
                                                    "area_cm2": 15,
                                                    "densidade_alvo": 25,
                                                    "enxertos": 375
                                                },
                                                {
                                                    "zona": "frontal",
                                                    "rotulo": "Frontal",
                                                    "area_cm2": 60,
                                                    "densidade_alvo": 30,
                                                    "enxertos": 1800
                                                }
                                            ]
                                        },
                                        "enfermagem": {
                                            "visivel": true,
                                            "registos": [
                                                {
                                                    "id": 3302,
                                                    "tipo": "sinais_vitais",
                                                    "tipo_rotulo": "Sinais vitais",
                                                    "dados": {
                                                        "tas": 128,
                                                        "tad": 79,
                                                        "fc": 72,
                                                        "spo2": 98
                                                    },
                                                    "texto": "TA 128/79 mmHg · FC 72 bpm · SpO₂ 98 %",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T10:00:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                },
                                                {
                                                    "id": 3301,
                                                    "tipo": "farmaco",
                                                    "tipo_rotulo": "Fármaco",
                                                    "dados": {
                                                        "nome": "Lidocaína com adrenalina",
                                                        "dose": 34,
                                                        "unidade": "ml",
                                                        "concentracao_pct": 1,
                                                        "via": "local",
                                                        "hora": "09:05",
                                                        "lote": "LX2291",
                                                        "adrenalina": true,
                                                        "artigo_id": 58
                                                    },
                                                    "texto": "Lidocaína com adrenalina 34,00 ml (1,0 %) · Local · 09:05 · Lote LX2291 · com adrenalina",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T09:05:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                }
                                            ],
                                            "lidocaina": {
                                                "mg_total": 340,
                                                "mg_kg": 4.25,
                                                "limite": 7,
                                                "com_adrenalina": true,
                                                "aviso_pct": 80,
                                                "percentagem": 61,
                                                "estado": "ok",
                                                "peso_kg": 80
                                            },
                                            "sinais_vitais": {
                                                "ultimo_em": "2026-11-18T10:00:00+00:00",
                                                "intervalo_min": 60,
                                                "em_atraso": false
                                            },
                                            "dor_ultima": 2,
                                            "vias": [
                                                {
                                                    "valor": "local",
                                                    "rotulo": "Local"
                                                },
                                                {
                                                    "valor": "subcutanea",
                                                    "rotulo": "Subcutânea"
                                                },
                                                {
                                                    "valor": "oral",
                                                    "rotulo": "Oral"
                                                }
                                            ],
                                            "unidades": [
                                                "mg",
                                                "ml",
                                                "mcg",
                                                "UI",
                                                "g"
                                            ]
                                        },
                                        "checklists": [
                                            {
                                                "id": 611,
                                                "nome": "Verificação de segurança antes da cirurgia",
                                                "fase": "pre_operatorio",
                                                "fase_rotulo": "Pré-operatório",
                                                "estado": "concluida",
                                                "itens": [
                                                    {
                                                        "texto": "Identidade do paciente confirmada",
                                                        "responsavel_papel": "enfermeiro",
                                                        "obrigatorio": true,
                                                        "feito": true,
                                                        "feito_por": 19,
                                                        "feito_por_nome": "Paulo Matos",
                                                        "feito_em": "2026-11-17T16:20:00+00:00"
                                                    },
                                                    {
                                                        "texto": "Análises pré-operatórias revistas",
                                                        "responsavel_papel": "cirurgiao",
                                                        "obrigatorio": true,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    },
                                                    {
                                                        "texto": "Fotografias pré-operatórias tiradas",
                                                        "responsavel_papel": "tecnico",
                                                        "obrigatorio": false,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    }
                                                ],
                                                "feitos": 3,
                                                "total": 3,
                                                "concluida_em": "2026-11-18T08:20:00+00:00"
                                            }
                                        ],
                                        "alta": null,
                                        "permissoes": {
                                            "registar": true,
                                            "abrir": false,
                                            "fechar": true,
                                            "enfermagem": true
                                        },
                                        "voz_palavras": {
                                            "1": [
                                                "um",
                                                "uma",
                                                "one",
                                                "uno",
                                                "un",
                                                "eins",
                                                "1"
                                            ],
                                            "2": [
                                                "dois",
                                                "duas",
                                                "two",
                                                "dos",
                                                "deux",
                                                "zwei",
                                                "2"
                                            ],
                                            "3": [
                                                "três",
                                                "tres",
                                                "three",
                                                "trois",
                                                "drei",
                                                "3"
                                            ],
                                            "4": [
                                                "quatro",
                                                "four",
                                                "cuatro",
                                                "quatre",
                                                "vier",
                                                "4"
                                            ],
                                            "desfazer": [
                                                "desfazer",
                                                "anular",
                                                "undo",
                                                "deshacer",
                                                "annuler",
                                                "rückgängig"
                                            ]
                                        },
                                        "atualizado_em": "2026-11-18T12:41:12+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Só uma cirurgia confirmada pode ser aberta."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Business rule (consentimento_em_falta)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "consentimento_em_falta": {
                                        "summary": "consentimento_em_falta",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "consentimento_em_falta",
                                                "mensagem": "Sem consentimento cirúrgico válido.",
                                                "campos": {
                                                    "consentimento": "Sem consentimento cirúrgico válido."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/alta": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelAlta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Record (or update) the discharge",
                "description": "During or after the session (409). Requires access to the patient clinical record. Instructions (default from Settings › Theatre; mandatory), medication (encrypted; only visible with clinical record access), emergency contact (default from Settings), grafts by FU type and total hairs (from implantation, or extraction when there is none), warranty certificate number the first time (Settings). With «lavagem_inicio» it books the first wash in the calendar (type «primeira_lavagem», confirmed, with conflict checks; resend with \"forcar\": true to accept warnings). Issues the discharge document in the documents module when it exists. Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "instrucoes": {
                                        "type": "string",
                                        "maxLength": 8000
                                    },
                                    "medicacao": {
                                        "type": "string",
                                        "maxLength": 4000
                                    },
                                    "contacto_urgencia": {
                                        "type": "string",
                                        "maxLength": 120
                                    },
                                    "lavagem_inicio": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "Book the first wash at this time."
                                    },
                                    "lavagem_profissional_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "forcar": {
                                        "type": "boolean",
                                        "description": "Accept the warnings (conflito_aviso: holiday, outside working hours, no working hours, past date). Never overrides blocking conflicts."
                                    }
                                }
                            },
                            "example": {
                                "instrucoes": "Dormir com a cabeça elevada nas primeiras 3 noites. Não molhar a zona recetora durante 48 h. Não usar chapéu apertado durante 10 dias.",
                                "medicacao": "Paracetamol 1 g de 8 em 8 horas durante 3 dias, se houver dor.",
                                "contacto_urgencia": "+351 210 000 000",
                                "lavagem_inicio": "2026-11-20T10:00:00+00:00",
                                "lavagem_profissional_id": 19
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "alta": {
                                                    "$ref": "#/components/schemas/M6Alta"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "alta": {
                                            "id": 97,
                                            "instrucoes": "Dormir com a cabeça elevada nas primeiras 3 noites. Não molhar a zona recetora durante 48 h. Não usar chapéu apertado durante 10 dias.",
                                            "medicacao": "Paracetamol 1 g de 8 em 8 horas durante 3 dias, se houver dor.",
                                            "medicacao_visivel": true,
                                            "contacto_urgencia": "+351 210 000 000",
                                            "primeira_lavagem": {
                                                "marcacao_id": 9011,
                                                "inicio": "2026-11-20T10:00:00+00:00",
                                                "estado": "confirmada"
                                            },
                                            "enxertos_por_tipo": {
                                                "1": 380,
                                                "2": 1100,
                                                "3": 700,
                                                "4": 120
                                            },
                                            "total_cabelos": 5160,
                                            "folha_entregue_em": null,
                                            "certificado_garantia": "GAR-2026-0088",
                                            "documento_id": 1450,
                                            "registada_por": "Paulo Matos",
                                            "registada_em": "2026-11-18T14:10:00+00:00"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido, conflito, conflito_aviso)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "A alta regista-se durante ou depois da sessão."
                                            }
                                        }
                                    },
                                    "conflito": {
                                        "summary": "conflito",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito",
                                                "mensagem": "Há conflitos na agenda.",
                                                "campos": {
                                                    "profissional_id": "Paulo Matos já tem uma marcação das 10:00–10:30."
                                                }
                                            }
                                        }
                                    },
                                    "conflito_aviso": {
                                        "summary": "conflito_aviso",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "conflito_aviso",
                                                "mensagem": "Há avisos na agenda. Confirme para continuar.",
                                                "campos": {
                                                    "inicio": "Fora do horário de Paulo Matos."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/amostra": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelAmostra",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Transection sample",
                "description": "n grafts observed (1 to 1000) and how many were transected (0 to n), per operator. The session and per-operator rates are recomputed on the server and stored on closing. Open session (409).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "amostra_n": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 1000,
                                        "x-unidade": "enxertos"
                                    },
                                    "transeccionados": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "x-unidade": "enxertos"
                                    },
                                    "operador_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "amostra_n",
                                    "transeccionados"
                                ]
                            },
                            "example": {
                                "amostra_n": 100,
                                "transeccionados": 3,
                                "operador_id": 7
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Painel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "cirurgia": {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "estado": "em_curso",
                                            "estado_rotulo": "Em curso",
                                            "estado_tom": "marca",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "sala_nome": "Bloco 1",
                                            "tecnica": "FUE",
                                            "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                            "inicio_real": "2026-11-18T08:41:00+00:00",
                                            "fim_real": null,
                                            "fase_atual": "implantacao",
                                            "pausada": false,
                                            "pausada_em": null,
                                            "decorrido_seg": 14100,
                                            "peso_kg": 80,
                                            "consentimento": true
                                        },
                                        "fases": [
                                            {
                                                "fase": "admissao",
                                                "rotulo": "Admissão",
                                                "duracao_seg": 900,
                                                "inicio": "2026-11-18T08:41:00+00:00",
                                                "fim": "2026-11-18T08:56:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "desenho",
                                                "rotulo": "Desenho",
                                                "duracao_seg": 1200,
                                                "inicio": "2026-11-18T08:56:00+00:00",
                                                "fim": "2026-11-18T09:16:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "anestesia",
                                                "rotulo": "Anestesia",
                                                "duracao_seg": 600,
                                                "inicio": "2026-11-18T09:16:00+00:00",
                                                "fim": "2026-11-18T09:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "extracao",
                                                "rotulo": "Extração",
                                                "duracao_seg": 6900,
                                                "inicio": "2026-11-18T09:26:00+00:00",
                                                "fim": "2026-11-18T11:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "implantacao",
                                                "rotulo": "Implantação",
                                                "duracao_seg": 4500,
                                                "inicio": "2026-11-18T11:26:00+00:00",
                                                "fim": null,
                                                "atual": true,
                                                "feita": false
                                            },
                                            {
                                                "fase": "penso",
                                                "rotulo": "Penso",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            },
                                            {
                                                "fase": "alta",
                                                "rotulo": "Alta",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "operadores": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 410,
                                                    "2": 1260,
                                                    "3": 820,
                                                    "4": 140
                                                },
                                                "total": 2630,
                                                "cabelos": 5950,
                                                "cabelos_por_enxerto": 2.26
                                            },
                                            "implantacao": {
                                                "por_tipo": {
                                                    "1": 380,
                                                    "2": 1100,
                                                    "3": 700,
                                                    "4": 120
                                                },
                                                "total": 2300,
                                                "cabelos": 5160,
                                                "cabelos_por_enxerto": 2.24
                                            },
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "extracao": 2630,
                                                    "implantacao": 0,
                                                    "por_tipo": {
                                                        "1": 410,
                                                        "2": 1260,
                                                        "3": 820,
                                                        "4": 140
                                                    },
                                                    "por_hora": 780
                                                },
                                                {
                                                    "operador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "extracao": 0,
                                                    "implantacao": 2300,
                                                    "por_tipo": {
                                                        "1": 380,
                                                        "2": 1100,
                                                        "3": 700,
                                                        "4": 120
                                                    },
                                                    "por_hora": 920
                                                }
                                            ]
                                        },
                                        "planeado": 2850,
                                        "progresso": {
                                            "extraido_pct": 92,
                                            "implantado_pct": 81
                                        },
                                        "ultima_contagem": {
                                            "id": 90412,
                                            "tipo_uf": 2,
                                            "momento": "implantacao",
                                            "operador": "Marta Sousa",
                                            "criado_em": "2026-11-18T12:41:09+00:00"
                                        },
                                        "lotes": [
                                            {
                                                "id": 51,
                                                "lote": "L1",
                                                "quantidade": 600,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T09:50:00+00:00",
                                                "implantado_em": "2026-11-18T11:35:00+00:00",
                                                "horas_fora": 1.75,
                                                "estado": "ok"
                                            },
                                            {
                                                "id": 52,
                                                "lote": "L2",
                                                "quantidade": 700,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T10:30:00+00:00",
                                                "implantado_em": null,
                                                "horas_fora": 2.18,
                                                "estado": "ok"
                                            }
                                        ],
                                        "tempo_fora": {
                                            "alerta_h": 4,
                                            "maximo_h": 6
                                        },
                                        "transeccao": {
                                            "sessao_pct": 3.5,
                                            "amostras": 2,
                                            "observados": 200,
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "pct": 3.5,
                                                    "observados": 200
                                                }
                                            ]
                                        },
                                        "plano": {
                                            "id": 318,
                                            "versao": 3,
                                            "tecnica": "FUE",
                                            "enxertos_necessarios": 3200,
                                            "capacidade_sessao": 2850,
                                            "zonas": [
                                                {
                                                    "zona": "linha_frontal",
                                                    "rotulo": "Linha frontal",
                                                    "area_cm2": 15,
                                                    "densidade_alvo": 25,
                                                    "enxertos": 375
                                                },
                                                {
                                                    "zona": "frontal",
                                                    "rotulo": "Frontal",
                                                    "area_cm2": 60,
                                                    "densidade_alvo": 30,
                                                    "enxertos": 1800
                                                }
                                            ]
                                        },
                                        "enfermagem": {
                                            "visivel": true,
                                            "registos": [
                                                {
                                                    "id": 3302,
                                                    "tipo": "sinais_vitais",
                                                    "tipo_rotulo": "Sinais vitais",
                                                    "dados": {
                                                        "tas": 128,
                                                        "tad": 79,
                                                        "fc": 72,
                                                        "spo2": 98
                                                    },
                                                    "texto": "TA 128/79 mmHg · FC 72 bpm · SpO₂ 98 %",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T10:00:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                },
                                                {
                                                    "id": 3301,
                                                    "tipo": "farmaco",
                                                    "tipo_rotulo": "Fármaco",
                                                    "dados": {
                                                        "nome": "Lidocaína com adrenalina",
                                                        "dose": 34,
                                                        "unidade": "ml",
                                                        "concentracao_pct": 1,
                                                        "via": "local",
                                                        "hora": "09:05",
                                                        "lote": "LX2291",
                                                        "adrenalina": true,
                                                        "artigo_id": 58
                                                    },
                                                    "texto": "Lidocaína com adrenalina 34,00 ml (1,0 %) · Local · 09:05 · Lote LX2291 · com adrenalina",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T09:05:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                }
                                            ],
                                            "lidocaina": {
                                                "mg_total": 340,
                                                "mg_kg": 4.25,
                                                "limite": 7,
                                                "com_adrenalina": true,
                                                "aviso_pct": 80,
                                                "percentagem": 61,
                                                "estado": "ok",
                                                "peso_kg": 80
                                            },
                                            "sinais_vitais": {
                                                "ultimo_em": "2026-11-18T10:00:00+00:00",
                                                "intervalo_min": 60,
                                                "em_atraso": false
                                            },
                                            "dor_ultima": 2,
                                            "vias": [
                                                {
                                                    "valor": "local",
                                                    "rotulo": "Local"
                                                },
                                                {
                                                    "valor": "subcutanea",
                                                    "rotulo": "Subcutânea"
                                                },
                                                {
                                                    "valor": "oral",
                                                    "rotulo": "Oral"
                                                }
                                            ],
                                            "unidades": [
                                                "mg",
                                                "ml",
                                                "mcg",
                                                "UI",
                                                "g"
                                            ]
                                        },
                                        "checklists": [
                                            {
                                                "id": 611,
                                                "nome": "Verificação de segurança antes da cirurgia",
                                                "fase": "pre_operatorio",
                                                "fase_rotulo": "Pré-operatório",
                                                "estado": "concluida",
                                                "itens": [
                                                    {
                                                        "texto": "Identidade do paciente confirmada",
                                                        "responsavel_papel": "enfermeiro",
                                                        "obrigatorio": true,
                                                        "feito": true,
                                                        "feito_por": 19,
                                                        "feito_por_nome": "Paulo Matos",
                                                        "feito_em": "2026-11-17T16:20:00+00:00"
                                                    },
                                                    {
                                                        "texto": "Análises pré-operatórias revistas",
                                                        "responsavel_papel": "cirurgiao",
                                                        "obrigatorio": true,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    },
                                                    {
                                                        "texto": "Fotografias pré-operatórias tiradas",
                                                        "responsavel_papel": "tecnico",
                                                        "obrigatorio": false,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    }
                                                ],
                                                "feitos": 3,
                                                "total": 3,
                                                "concluida_em": "2026-11-18T08:20:00+00:00"
                                            }
                                        ],
                                        "alta": null,
                                        "permissoes": {
                                            "registar": true,
                                            "abrir": false,
                                            "fechar": true,
                                            "enfermagem": true
                                        },
                                        "voz_palavras": {
                                            "1": [
                                                "um",
                                                "uma",
                                                "one",
                                                "uno",
                                                "un",
                                                "eins",
                                                "1"
                                            ],
                                            "2": [
                                                "dois",
                                                "duas",
                                                "two",
                                                "dos",
                                                "deux",
                                                "zwei",
                                                "2"
                                            ],
                                            "3": [
                                                "três",
                                                "tres",
                                                "three",
                                                "trois",
                                                "drei",
                                                "3"
                                            ],
                                            "4": [
                                                "quatro",
                                                "four",
                                                "cuatro",
                                                "quatre",
                                                "vier",
                                                "4"
                                            ],
                                            "desfazer": [
                                                "desfazer",
                                                "anular",
                                                "undo",
                                                "deshacer",
                                                "annuler",
                                                "rückgängig"
                                            ]
                                        },
                                        "atualizado_em": "2026-11-18T12:41:12+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Abra primeiro a sessão."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/anular": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelAnularEnfermagem",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Void a nursing record",
                "description": "Correction by voiding with a mandatory reason (up to 255 characters): the original record is kept, flagged as voided, and stops counting (for example in the lidocaine dose). Missing or already voided record → 404. Completed or cancelled surgery → 409. Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "registo_id": {
                                        "type": "integer"
                                    },
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 255
                                    }
                                },
                                "required": [
                                    "registo_id",
                                    "motivo"
                                ]
                            },
                            "example": {
                                "registo_id": 3301,
                                "motivo": "Dose registada em duplicado."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "enfermagem": {
                                                    "$ref": "#/components/schemas/M6Enfermagem"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "enfermagem": {
                                            "visivel": true,
                                            "registos": [
                                                {
                                                    "id": 3302,
                                                    "tipo": "sinais_vitais",
                                                    "tipo_rotulo": "Sinais vitais",
                                                    "dados": {
                                                        "tas": 128,
                                                        "tad": 79,
                                                        "fc": 72,
                                                        "spo2": 98
                                                    },
                                                    "texto": "TA 128/79 mmHg · FC 72 bpm · SpO₂ 98 %",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T10:00:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                },
                                                {
                                                    "id": 3301,
                                                    "tipo": "farmaco",
                                                    "tipo_rotulo": "Fármaco",
                                                    "dados": {
                                                        "nome": "Lidocaína com adrenalina",
                                                        "dose": 34,
                                                        "unidade": "ml",
                                                        "concentracao_pct": 1,
                                                        "via": "local",
                                                        "hora": "09:05",
                                                        "lote": "LX2291",
                                                        "adrenalina": true,
                                                        "artigo_id": 58
                                                    },
                                                    "texto": "Lidocaína com adrenalina 34,00 ml (1,0 %) · Local · 09:05 · Lote LX2291 · com adrenalina",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T09:05:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                }
                                            ],
                                            "lidocaina": {
                                                "mg_total": 340,
                                                "mg_kg": 4.25,
                                                "limite": 7,
                                                "com_adrenalina": true,
                                                "aviso_pct": 80,
                                                "percentagem": 61,
                                                "estado": "ok",
                                                "peso_kg": 80
                                            },
                                            "sinais_vitais": {
                                                "ultimo_em": "2026-11-18T10:00:00+00:00",
                                                "intervalo_min": 60,
                                                "em_atraso": false
                                            },
                                            "dor_ultima": 2,
                                            "vias": [
                                                {
                                                    "valor": "local",
                                                    "rotulo": "Local"
                                                },
                                                {
                                                    "valor": "subcutanea",
                                                    "rotulo": "Subcutânea"
                                                },
                                                {
                                                    "valor": "oral",
                                                    "rotulo": "Oral"
                                                }
                                            ],
                                            "unidades": [
                                                "mg",
                                                "ml",
                                                "mcg",
                                                "UI",
                                                "g"
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "A sessão já está fechada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/checklist": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelChecklist",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Tick an item of a session checklist",
                "description": "Same rules as POST /bloco/checklists/{id}/itens, from the panel (checklist_id from M6Painel.checklists).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "checklist_id": {
                                        "type": "integer"
                                    },
                                    "indice": {
                                        "type": "integer",
                                        "minimum": 0
                                    },
                                    "feito": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "checklist_id",
                                    "indice",
                                    "feito"
                                ]
                            },
                            "example": {
                                "checklist_id": 640,
                                "indice": 0,
                                "feito": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "checklist": {
                                                    "$ref": "#/components/schemas/M6Checklist"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "checklist": {
                                            "id": 640,
                                            "nome": "Implantação",
                                            "fase": "implantacao",
                                            "fase_rotulo": "Implantação",
                                            "estado": "aberta",
                                            "itens": [
                                                {
                                                    "texto": "Identidade do paciente confirmada",
                                                    "responsavel_papel": "enfermeiro",
                                                    "obrigatorio": true,
                                                    "feito": true,
                                                    "feito_por": 19,
                                                    "feito_por_nome": "Paulo Matos",
                                                    "feito_em": "2026-11-17T16:20:00+00:00"
                                                },
                                                {
                                                    "texto": "Análises pré-operatórias revistas",
                                                    "responsavel_papel": "cirurgiao",
                                                    "obrigatorio": true,
                                                    "feito": false,
                                                    "feito_por": null,
                                                    "feito_por_nome": null,
                                                    "feito_em": null
                                                },
                                                {
                                                    "texto": "Fotografias pré-operatórias tiradas",
                                                    "responsavel_papel": "tecnico",
                                                    "obrigatorio": false,
                                                    "feito": false,
                                                    "feito_por": null,
                                                    "feito_por_nome": null,
                                                    "feito_em": null
                                                }
                                            ],
                                            "feitos": 1,
                                            "total": 3,
                                            "concluida_em": null
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "A sessão já está fechada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/contar": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelContar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Count grafts",
                "description": "Records grafts by FU type — 1, 2, 3 or 4 (4 = 4 or more hairs; counts as the number of hairs in Settings › Theatre, minimum 4) — at the extraction or implantation moment, per operator (default: the person recording), by touch, voice or pedal/keys. Quantity 1 by default, up to 50 at once to correct in bulk. Open session (409). Light response for the counting screen (without the full panel). Limit: 600 requests per minute.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tipo_uf": {
                                        "type": "integer",
                                        "enum": [
                                            1,
                                            2,
                                            3,
                                            4
                                        ],
                                        "description": "FU type (4 = 4+ hairs)."
                                    },
                                    "momento": {
                                        "type": "string",
                                        "enum": [
                                            "extracao",
                                            "implantacao"
                                        ],
                                        "default": "extracao"
                                    },
                                    "quantidade": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 50,
                                        "default": 1,
                                        "x-unidade": "enxertos"
                                    },
                                    "origem": {
                                        "type": "string",
                                        "enum": [
                                            "toque",
                                            "voz",
                                            "pedal"
                                        ],
                                        "default": "toque"
                                    },
                                    "operador_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Operator (default: the person recording)."
                                    },
                                    "lote": {
                                        "type": "string",
                                        "maxLength": 20
                                    }
                                },
                                "required": [
                                    "tipo_uf"
                                ]
                            },
                            "example": {
                                "tipo_uf": 2,
                                "momento": "implantacao",
                                "quantidade": 1,
                                "origem": "toque",
                                "operador_id": 15
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6ResumoContagem"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 410,
                                                    "2": 1260,
                                                    "3": 820,
                                                    "4": 140
                                                },
                                                "total": 2630,
                                                "cabelos": 5950,
                                                "cabelos_por_enxerto": 2.26
                                            },
                                            "implantacao": {
                                                "por_tipo": {
                                                    "1": 380,
                                                    "2": 1100,
                                                    "3": 700,
                                                    "4": 120
                                                },
                                                "total": 2300,
                                                "cabelos": 5160,
                                                "cabelos_por_enxerto": 2.24
                                            },
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "extracao": 2630,
                                                    "implantacao": 0,
                                                    "por_tipo": {
                                                        "1": 410,
                                                        "2": 1260,
                                                        "3": 820,
                                                        "4": 140
                                                    },
                                                    "por_hora": 780
                                                },
                                                {
                                                    "operador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "extracao": 0,
                                                    "implantacao": 2300,
                                                    "por_tipo": {
                                                        "1": 380,
                                                        "2": 1100,
                                                        "3": 700,
                                                        "4": 120
                                                    },
                                                    "por_hora": 920
                                                }
                                            ]
                                        },
                                        "planeado": 2850,
                                        "progresso": {
                                            "extraido_pct": 92,
                                            "implantado_pct": 81
                                        },
                                        "ultima_contagem": {
                                            "id": 90412,
                                            "tipo_uf": 2,
                                            "momento": "implantacao",
                                            "operador": "Marta Sousa",
                                            "criado_em": "2026-11-18T12:41:09+00:00"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Abra primeiro a sessão."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/desfazer": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelDesfazer",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Undo the last count",
                "description": "Voids (clinical record: nothing is deleted) the last count of the last 10 minutes, or the one given in «contagem_id» if still in that window. No recent counts → 409 «nada_a_desfazer». Open session (409).",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "contagem_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "contagem_id": 90412
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6ResumoContagem"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 410,
                                                    "2": 1260,
                                                    "3": 820,
                                                    "4": 140
                                                },
                                                "total": 2630,
                                                "cabelos": 5950,
                                                "cabelos_por_enxerto": 2.26
                                            },
                                            "implantacao": {
                                                "por_tipo": {
                                                    "1": 380,
                                                    "2": 1100,
                                                    "3": 700,
                                                    "4": 120
                                                },
                                                "total": 2300,
                                                "cabelos": 5160,
                                                "cabelos_por_enxerto": 2.24
                                            },
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "extracao": 2630,
                                                    "implantacao": 0,
                                                    "por_tipo": {
                                                        "1": 410,
                                                        "2": 1260,
                                                        "3": 820,
                                                        "4": 140
                                                    },
                                                    "por_hora": 780
                                                },
                                                {
                                                    "operador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "extracao": 0,
                                                    "implantacao": 2300,
                                                    "por_tipo": {
                                                        "1": 380,
                                                        "2": 1100,
                                                        "3": 700,
                                                        "4": 120
                                                    },
                                                    "por_hora": 920
                                                }
                                            ]
                                        },
                                        "planeado": 2850,
                                        "progresso": {
                                            "extraido_pct": 92,
                                            "implantado_pct": 81
                                        },
                                        "ultima_contagem": {
                                            "id": 90412,
                                            "tipo_uf": 2,
                                            "momento": "implantacao",
                                            "operador": "Marta Sousa",
                                            "criado_em": "2026-11-18T12:41:09+00:00"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (nada_a_desfazer, estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "nada_a_desfazer": {
                                        "summary": "nada_a_desfazer",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "nada_a_desfazer",
                                                "mensagem": "Não há contagens recentes para desfazer."
                                            }
                                        }
                                    },
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Abra primeiro a sessão."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/enfermagem": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelEnfermagem",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Nursing and anaesthesia record",
                "description": "Types: sinais_vitais, farmaco, dor, incidente, nota (fields and ranges in M6EnfSinaisVitais, M6EnfFarmaco, M6EnfDor, M6EnfIncidente, M6EnfNota). Data encrypted with the clinical key; the audit log only keeps field names. Requires access to the patient clinical record. Lidocaine (name containing lidoca/xiloca/lignoca): cumulative dose in mg (ml × concentration % × 10; mcg ÷ 1000; g × 1000) divided by weight; limit 4.5 mg/kg, or 7 mg/kg when every administration had adrenaline (Settings › Theatre); «aviso» from the warning percentage (80 % by default) and «perigo» when reaching the limit — in those cases the surgery team gets a notification (without clinical content). For lidocaine in ml the concentration is mandatory. A high-severity incident also notifies the team. Completed or cancelled surgery → 409.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "sinais_vitais",
                                            "farmaco",
                                            "dor",
                                            "incidente",
                                            "nota"
                                        ]
                                    },
                                    "dados": {
                                        "oneOf": [
                                            {
                                                "$ref": "#/components/schemas/M6EnfSinaisVitais"
                                            },
                                            {
                                                "$ref": "#/components/schemas/M6EnfFarmaco"
                                            },
                                            {
                                                "$ref": "#/components/schemas/M6EnfDor"
                                            },
                                            {
                                                "$ref": "#/components/schemas/M6EnfIncidente"
                                            },
                                            {
                                                "$ref": "#/components/schemas/M6EnfNota"
                                            }
                                        ]
                                    },
                                    "registado_em": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "Record time (default now)."
                                    }
                                },
                                "required": [
                                    "tipo",
                                    "dados"
                                ]
                            },
                            "example": {
                                "tipo": "farmaco",
                                "dados": {
                                    "nome": "Lidocaína com adrenalina",
                                    "dose": 34,
                                    "unidade": "ml",
                                    "concentracao_pct": 1,
                                    "via": "local",
                                    "hora": "09:05",
                                    "lote": "LX2291",
                                    "adrenalina": true,
                                    "artigo_id": 58
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "enfermagem": {
                                                    "$ref": "#/components/schemas/M6Enfermagem"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "enfermagem": {
                                            "visivel": true,
                                            "registos": [
                                                {
                                                    "id": 3302,
                                                    "tipo": "sinais_vitais",
                                                    "tipo_rotulo": "Sinais vitais",
                                                    "dados": {
                                                        "tas": 128,
                                                        "tad": 79,
                                                        "fc": 72,
                                                        "spo2": 98
                                                    },
                                                    "texto": "TA 128/79 mmHg · FC 72 bpm · SpO₂ 98 %",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T10:00:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                },
                                                {
                                                    "id": 3301,
                                                    "tipo": "farmaco",
                                                    "tipo_rotulo": "Fármaco",
                                                    "dados": {
                                                        "nome": "Lidocaína com adrenalina",
                                                        "dose": 34,
                                                        "unidade": "ml",
                                                        "concentracao_pct": 1,
                                                        "via": "local",
                                                        "hora": "09:05",
                                                        "lote": "LX2291",
                                                        "adrenalina": true,
                                                        "artigo_id": 58
                                                    },
                                                    "texto": "Lidocaína com adrenalina 34,00 ml (1,0 %) · Local · 09:05 · Lote LX2291 · com adrenalina",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T09:05:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                }
                                            ],
                                            "lidocaina": {
                                                "mg_total": 340,
                                                "mg_kg": 4.25,
                                                "limite": 7,
                                                "com_adrenalina": true,
                                                "aviso_pct": 80,
                                                "percentagem": 61,
                                                "estado": "ok",
                                                "peso_kg": 80
                                            },
                                            "sinais_vitais": {
                                                "ultimo_em": "2026-11-18T10:00:00+00:00",
                                                "intervalo_min": 60,
                                                "em_atraso": false
                                            },
                                            "dor_ultima": 2,
                                            "vias": [
                                                {
                                                    "valor": "local",
                                                    "rotulo": "Local"
                                                },
                                                {
                                                    "valor": "subcutanea",
                                                    "rotulo": "Subcutânea"
                                                },
                                                {
                                                    "valor": "oral",
                                                    "rotulo": "Oral"
                                                }
                                            ],
                                            "unidades": [
                                                "mg",
                                                "ml",
                                                "mcg",
                                                "UI",
                                                "g"
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "A sessão já está fechada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/entregue": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelFolhaEntregue",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Discharge sheet handed to the patient",
                "description": "Records when the discharge sheet (grafts by FU type and total hairs) was handed over. No discharge recorded → 404. Effects: «print» audit.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "alta": {
                                                    "$ref": "#/components/schemas/M6Alta"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "alta": {
                                            "id": 97,
                                            "instrucoes": "Dormir com a cabeça elevada nas primeiras 3 noites. Não molhar a zona recetora durante 48 h. Não usar chapéu apertado durante 10 dias.",
                                            "medicacao": "Paracetamol 1 g de 8 em 8 horas durante 3 dias, se houver dor.",
                                            "medicacao_visivel": true,
                                            "contacto_urgencia": "+351 210 000 000",
                                            "primeira_lavagem": {
                                                "marcacao_id": 9011,
                                                "inicio": "2026-11-20T10:00:00+00:00",
                                                "estado": "confirmada"
                                            },
                                            "enxertos_por_tipo": {
                                                "1": 380,
                                                "2": 1100,
                                                "3": 700,
                                                "4": 120
                                            },
                                            "total_cabelos": 5160,
                                            "folha_entregue_em": "2026-11-18T14:25:00+00:00",
                                            "certificado_garantia": "GAR-2026-0088",
                                            "documento_id": 1450,
                                            "registada_por": "Paulo Matos",
                                            "registada_em": "2026-11-18T14:10:00+00:00"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/fase": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelFase",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Change phase",
                "description": "Open session (409). Closes the current phase (pauses deducted), opens the new one and creates its checklists (ids in «checklists_novas»). The appointment changes station on the day board (drawing/anaesthesia → preparation, extraction, implantation, dressing → recovery). Asking for the current phase returns the panel unchanged. Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "fase": {
                                        "type": "string",
                                        "enum": [
                                            "admissao",
                                            "desenho",
                                            "anestesia",
                                            "extracao",
                                            "implantacao",
                                            "penso",
                                            "alta"
                                        ]
                                    }
                                },
                                "required": [
                                    "fase"
                                ]
                            },
                            "example": {
                                "fase": "implantacao"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/M6Painel"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "checklists_novas": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    }
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "cirurgia": {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "estado": "em_curso",
                                            "estado_rotulo": "Em curso",
                                            "estado_tom": "marca",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "sala_nome": "Bloco 1",
                                            "tecnica": "FUE",
                                            "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                            "inicio_real": "2026-11-18T08:41:00+00:00",
                                            "fim_real": null,
                                            "fase_atual": "implantacao",
                                            "pausada": false,
                                            "pausada_em": null,
                                            "decorrido_seg": 14100,
                                            "peso_kg": 80,
                                            "consentimento": true
                                        },
                                        "fases": [
                                            {
                                                "fase": "admissao",
                                                "rotulo": "Admissão",
                                                "duracao_seg": 900,
                                                "inicio": "2026-11-18T08:41:00+00:00",
                                                "fim": "2026-11-18T08:56:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "desenho",
                                                "rotulo": "Desenho",
                                                "duracao_seg": 1200,
                                                "inicio": "2026-11-18T08:56:00+00:00",
                                                "fim": "2026-11-18T09:16:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "anestesia",
                                                "rotulo": "Anestesia",
                                                "duracao_seg": 600,
                                                "inicio": "2026-11-18T09:16:00+00:00",
                                                "fim": "2026-11-18T09:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "extracao",
                                                "rotulo": "Extração",
                                                "duracao_seg": 6900,
                                                "inicio": "2026-11-18T09:26:00+00:00",
                                                "fim": "2026-11-18T11:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "implantacao",
                                                "rotulo": "Implantação",
                                                "duracao_seg": 4500,
                                                "inicio": "2026-11-18T11:26:00+00:00",
                                                "fim": null,
                                                "atual": true,
                                                "feita": false
                                            },
                                            {
                                                "fase": "penso",
                                                "rotulo": "Penso",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            },
                                            {
                                                "fase": "alta",
                                                "rotulo": "Alta",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "operadores": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 410,
                                                    "2": 1260,
                                                    "3": 820,
                                                    "4": 140
                                                },
                                                "total": 2630,
                                                "cabelos": 5950,
                                                "cabelos_por_enxerto": 2.26
                                            },
                                            "implantacao": {
                                                "por_tipo": {
                                                    "1": 380,
                                                    "2": 1100,
                                                    "3": 700,
                                                    "4": 120
                                                },
                                                "total": 2300,
                                                "cabelos": 5160,
                                                "cabelos_por_enxerto": 2.24
                                            },
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "extracao": 2630,
                                                    "implantacao": 0,
                                                    "por_tipo": {
                                                        "1": 410,
                                                        "2": 1260,
                                                        "3": 820,
                                                        "4": 140
                                                    },
                                                    "por_hora": 780
                                                },
                                                {
                                                    "operador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "extracao": 0,
                                                    "implantacao": 2300,
                                                    "por_tipo": {
                                                        "1": 380,
                                                        "2": 1100,
                                                        "3": 700,
                                                        "4": 120
                                                    },
                                                    "por_hora": 920
                                                }
                                            ]
                                        },
                                        "planeado": 2850,
                                        "progresso": {
                                            "extraido_pct": 92,
                                            "implantado_pct": 81
                                        },
                                        "ultima_contagem": {
                                            "id": 90412,
                                            "tipo_uf": 2,
                                            "momento": "implantacao",
                                            "operador": "Marta Sousa",
                                            "criado_em": "2026-11-18T12:41:09+00:00"
                                        },
                                        "lotes": [
                                            {
                                                "id": 51,
                                                "lote": "L1",
                                                "quantidade": 600,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T09:50:00+00:00",
                                                "implantado_em": "2026-11-18T11:35:00+00:00",
                                                "horas_fora": 1.75,
                                                "estado": "ok"
                                            },
                                            {
                                                "id": 52,
                                                "lote": "L2",
                                                "quantidade": 700,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T10:30:00+00:00",
                                                "implantado_em": null,
                                                "horas_fora": 2.18,
                                                "estado": "ok"
                                            }
                                        ],
                                        "tempo_fora": {
                                            "alerta_h": 4,
                                            "maximo_h": 6
                                        },
                                        "transeccao": {
                                            "sessao_pct": 3.5,
                                            "amostras": 2,
                                            "observados": 200,
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "pct": 3.5,
                                                    "observados": 200
                                                }
                                            ]
                                        },
                                        "plano": {
                                            "id": 318,
                                            "versao": 3,
                                            "tecnica": "FUE",
                                            "enxertos_necessarios": 3200,
                                            "capacidade_sessao": 2850,
                                            "zonas": [
                                                {
                                                    "zona": "linha_frontal",
                                                    "rotulo": "Linha frontal",
                                                    "area_cm2": 15,
                                                    "densidade_alvo": 25,
                                                    "enxertos": 375
                                                },
                                                {
                                                    "zona": "frontal",
                                                    "rotulo": "Frontal",
                                                    "area_cm2": 60,
                                                    "densidade_alvo": 30,
                                                    "enxertos": 1800
                                                }
                                            ]
                                        },
                                        "enfermagem": {
                                            "visivel": true,
                                            "registos": [
                                                {
                                                    "id": 3302,
                                                    "tipo": "sinais_vitais",
                                                    "tipo_rotulo": "Sinais vitais",
                                                    "dados": {
                                                        "tas": 128,
                                                        "tad": 79,
                                                        "fc": 72,
                                                        "spo2": 98
                                                    },
                                                    "texto": "TA 128/79 mmHg · FC 72 bpm · SpO₂ 98 %",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T10:00:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                },
                                                {
                                                    "id": 3301,
                                                    "tipo": "farmaco",
                                                    "tipo_rotulo": "Fármaco",
                                                    "dados": {
                                                        "nome": "Lidocaína com adrenalina",
                                                        "dose": 34,
                                                        "unidade": "ml",
                                                        "concentracao_pct": 1,
                                                        "via": "local",
                                                        "hora": "09:05",
                                                        "lote": "LX2291",
                                                        "adrenalina": true,
                                                        "artigo_id": 58
                                                    },
                                                    "texto": "Lidocaína com adrenalina 34,00 ml (1,0 %) · Local · 09:05 · Lote LX2291 · com adrenalina",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T09:05:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                }
                                            ],
                                            "lidocaina": {
                                                "mg_total": 340,
                                                "mg_kg": 4.25,
                                                "limite": 7,
                                                "com_adrenalina": true,
                                                "aviso_pct": 80,
                                                "percentagem": 61,
                                                "estado": "ok",
                                                "peso_kg": 80
                                            },
                                            "sinais_vitais": {
                                                "ultimo_em": "2026-11-18T10:00:00+00:00",
                                                "intervalo_min": 60,
                                                "em_atraso": false
                                            },
                                            "dor_ultima": 2,
                                            "vias": [
                                                {
                                                    "valor": "local",
                                                    "rotulo": "Local"
                                                },
                                                {
                                                    "valor": "subcutanea",
                                                    "rotulo": "Subcutânea"
                                                },
                                                {
                                                    "valor": "oral",
                                                    "rotulo": "Oral"
                                                }
                                            ],
                                            "unidades": [
                                                "mg",
                                                "ml",
                                                "mcg",
                                                "UI",
                                                "g"
                                            ]
                                        },
                                        "checklists": [
                                            {
                                                "id": 611,
                                                "nome": "Verificação de segurança antes da cirurgia",
                                                "fase": "pre_operatorio",
                                                "fase_rotulo": "Pré-operatório",
                                                "estado": "concluida",
                                                "itens": [
                                                    {
                                                        "texto": "Identidade do paciente confirmada",
                                                        "responsavel_papel": "enfermeiro",
                                                        "obrigatorio": true,
                                                        "feito": true,
                                                        "feito_por": 19,
                                                        "feito_por_nome": "Paulo Matos",
                                                        "feito_em": "2026-11-17T16:20:00+00:00"
                                                    },
                                                    {
                                                        "texto": "Análises pré-operatórias revistas",
                                                        "responsavel_papel": "cirurgiao",
                                                        "obrigatorio": true,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    },
                                                    {
                                                        "texto": "Fotografias pré-operatórias tiradas",
                                                        "responsavel_papel": "tecnico",
                                                        "obrigatorio": false,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    }
                                                ],
                                                "feitos": 3,
                                                "total": 3,
                                                "concluida_em": "2026-11-18T08:20:00+00:00"
                                            }
                                        ],
                                        "alta": null,
                                        "permissoes": {
                                            "registar": true,
                                            "abrir": false,
                                            "fechar": true,
                                            "enfermagem": true
                                        },
                                        "voz_palavras": {
                                            "1": [
                                                "um",
                                                "uma",
                                                "one",
                                                "uno",
                                                "un",
                                                "eins",
                                                "1"
                                            ],
                                            "2": [
                                                "dois",
                                                "duas",
                                                "two",
                                                "dos",
                                                "deux",
                                                "zwei",
                                                "2"
                                            ],
                                            "3": [
                                                "três",
                                                "tres",
                                                "three",
                                                "trois",
                                                "drei",
                                                "3"
                                            ],
                                            "4": [
                                                "quatro",
                                                "four",
                                                "cuatro",
                                                "quatre",
                                                "vier",
                                                "4"
                                            ],
                                            "desfazer": [
                                                "desfazer",
                                                "anular",
                                                "undo",
                                                "deshacer",
                                                "annuler",
                                                "rückgängig"
                                            ]
                                        },
                                        "atualizado_em": "2026-11-18T12:41:12+00:00",
                                        "checklists_novas": [
                                            640
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Abra primeiro a sessão."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/fechar": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelFechar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Close the session (definitive)",
                "description": "Definitive: once closed, the session no longer accepts records. Requires \"confirmacao\" equal to the surgery number (case-insensitive; 422 «validacao»), recorded counts (422 «sem_contagens») and, when Settings › Theatre › mandatory vital signs is on, vital signs (422 «sinais_vitais_em_falta»). Only with the session open (409). Stores extracted and implanted grafts, grafts by FU type, total hairs (from implantation, or extraction when there is none) and the transection rate; closes the current phase and the batches not yet implanted; completes the appointment. Fires, when the modules exist (each one guarded — closing never fails because of them; result in «efeitos»: ok | erro | indisponivel): post-operative follow-up milestones, team fees, stock consumption of drugs with item and lot, episode → «post-operative» and the cirurgia.fechada webhook. Effects: clinical timeline event, team notification and audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "confirmacao": {
                                        "type": "string",
                                        "description": "Surgery number, as a second confirmation."
                                    }
                                },
                                "required": [
                                    "confirmacao"
                                ]
                            },
                            "example": {
                                "confirmacao": "CIR-2026-0214"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/M6Painel"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "efeitos": {
                                                            "$ref": "#/components/schemas/M6EfeitosFecho"
                                                        }
                                                    }
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "cirurgia": {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "estado": "concluida",
                                            "estado_rotulo": "Concluída",
                                            "estado_tom": "neutro",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "sala_nome": "Bloco 1",
                                            "tecnica": "FUE",
                                            "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                            "inicio_real": "2026-11-18T08:41:00+00:00",
                                            "fim_real": "2026-11-18T14:05:00+00:00",
                                            "fase_atual": "alta",
                                            "pausada": false,
                                            "pausada_em": null,
                                            "decorrido_seg": 14100,
                                            "peso_kg": 80,
                                            "consentimento": true
                                        },
                                        "fases": [
                                            {
                                                "fase": "admissao",
                                                "rotulo": "Admissão",
                                                "duracao_seg": 900,
                                                "inicio": "2026-11-18T08:41:00+00:00",
                                                "fim": "2026-11-18T08:56:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "desenho",
                                                "rotulo": "Desenho",
                                                "duracao_seg": 1200,
                                                "inicio": "2026-11-18T08:56:00+00:00",
                                                "fim": "2026-11-18T09:16:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "anestesia",
                                                "rotulo": "Anestesia",
                                                "duracao_seg": 600,
                                                "inicio": "2026-11-18T09:16:00+00:00",
                                                "fim": "2026-11-18T09:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "extracao",
                                                "rotulo": "Extração",
                                                "duracao_seg": 6900,
                                                "inicio": "2026-11-18T09:26:00+00:00",
                                                "fim": "2026-11-18T11:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "implantacao",
                                                "rotulo": "Implantação",
                                                "duracao_seg": 4500,
                                                "inicio": "2026-11-18T11:26:00+00:00",
                                                "fim": null,
                                                "atual": true,
                                                "feita": false
                                            },
                                            {
                                                "fase": "penso",
                                                "rotulo": "Penso",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            },
                                            {
                                                "fase": "alta",
                                                "rotulo": "Alta",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "operadores": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 410,
                                                    "2": 1260,
                                                    "3": 820,
                                                    "4": 140
                                                },
                                                "total": 2630,
                                                "cabelos": 5950,
                                                "cabelos_por_enxerto": 2.26
                                            },
                                            "implantacao": {
                                                "por_tipo": {
                                                    "1": 380,
                                                    "2": 1100,
                                                    "3": 700,
                                                    "4": 120
                                                },
                                                "total": 2300,
                                                "cabelos": 5160,
                                                "cabelos_por_enxerto": 2.24
                                            },
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "extracao": 2630,
                                                    "implantacao": 0,
                                                    "por_tipo": {
                                                        "1": 410,
                                                        "2": 1260,
                                                        "3": 820,
                                                        "4": 140
                                                    },
                                                    "por_hora": 780
                                                },
                                                {
                                                    "operador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "extracao": 0,
                                                    "implantacao": 2300,
                                                    "por_tipo": {
                                                        "1": 380,
                                                        "2": 1100,
                                                        "3": 700,
                                                        "4": 120
                                                    },
                                                    "por_hora": 920
                                                }
                                            ]
                                        },
                                        "planeado": 2850,
                                        "progresso": {
                                            "extraido_pct": 92,
                                            "implantado_pct": 81
                                        },
                                        "ultima_contagem": {
                                            "id": 90412,
                                            "tipo_uf": 2,
                                            "momento": "implantacao",
                                            "operador": "Marta Sousa",
                                            "criado_em": "2026-11-18T12:41:09+00:00"
                                        },
                                        "lotes": [
                                            {
                                                "id": 51,
                                                "lote": "L1",
                                                "quantidade": 600,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T09:50:00+00:00",
                                                "implantado_em": "2026-11-18T11:35:00+00:00",
                                                "horas_fora": 1.75,
                                                "estado": "ok"
                                            },
                                            {
                                                "id": 52,
                                                "lote": "L2",
                                                "quantidade": 700,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T10:30:00+00:00",
                                                "implantado_em": null,
                                                "horas_fora": 2.18,
                                                "estado": "ok"
                                            }
                                        ],
                                        "tempo_fora": {
                                            "alerta_h": 4,
                                            "maximo_h": 6
                                        },
                                        "transeccao": {
                                            "sessao_pct": 3.5,
                                            "amostras": 2,
                                            "observados": 200,
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "pct": 3.5,
                                                    "observados": 200
                                                }
                                            ]
                                        },
                                        "plano": {
                                            "id": 318,
                                            "versao": 3,
                                            "tecnica": "FUE",
                                            "enxertos_necessarios": 3200,
                                            "capacidade_sessao": 2850,
                                            "zonas": [
                                                {
                                                    "zona": "linha_frontal",
                                                    "rotulo": "Linha frontal",
                                                    "area_cm2": 15,
                                                    "densidade_alvo": 25,
                                                    "enxertos": 375
                                                },
                                                {
                                                    "zona": "frontal",
                                                    "rotulo": "Frontal",
                                                    "area_cm2": 60,
                                                    "densidade_alvo": 30,
                                                    "enxertos": 1800
                                                }
                                            ]
                                        },
                                        "enfermagem": {
                                            "visivel": true,
                                            "registos": [
                                                {
                                                    "id": 3302,
                                                    "tipo": "sinais_vitais",
                                                    "tipo_rotulo": "Sinais vitais",
                                                    "dados": {
                                                        "tas": 128,
                                                        "tad": 79,
                                                        "fc": 72,
                                                        "spo2": 98
                                                    },
                                                    "texto": "TA 128/79 mmHg · FC 72 bpm · SpO₂ 98 %",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T10:00:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                },
                                                {
                                                    "id": 3301,
                                                    "tipo": "farmaco",
                                                    "tipo_rotulo": "Fármaco",
                                                    "dados": {
                                                        "nome": "Lidocaína com adrenalina",
                                                        "dose": 34,
                                                        "unidade": "ml",
                                                        "concentracao_pct": 1,
                                                        "via": "local",
                                                        "hora": "09:05",
                                                        "lote": "LX2291",
                                                        "adrenalina": true,
                                                        "artigo_id": 58
                                                    },
                                                    "texto": "Lidocaína com adrenalina 34,00 ml (1,0 %) · Local · 09:05 · Lote LX2291 · com adrenalina",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T09:05:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                }
                                            ],
                                            "lidocaina": {
                                                "mg_total": 340,
                                                "mg_kg": 4.25,
                                                "limite": 7,
                                                "com_adrenalina": true,
                                                "aviso_pct": 80,
                                                "percentagem": 61,
                                                "estado": "ok",
                                                "peso_kg": 80
                                            },
                                            "sinais_vitais": {
                                                "ultimo_em": "2026-11-18T10:00:00+00:00",
                                                "intervalo_min": 60,
                                                "em_atraso": false
                                            },
                                            "dor_ultima": 2,
                                            "vias": [
                                                {
                                                    "valor": "local",
                                                    "rotulo": "Local"
                                                },
                                                {
                                                    "valor": "subcutanea",
                                                    "rotulo": "Subcutânea"
                                                },
                                                {
                                                    "valor": "oral",
                                                    "rotulo": "Oral"
                                                }
                                            ],
                                            "unidades": [
                                                "mg",
                                                "ml",
                                                "mcg",
                                                "UI",
                                                "g"
                                            ]
                                        },
                                        "checklists": [
                                            {
                                                "id": 611,
                                                "nome": "Verificação de segurança antes da cirurgia",
                                                "fase": "pre_operatorio",
                                                "fase_rotulo": "Pré-operatório",
                                                "estado": "concluida",
                                                "itens": [
                                                    {
                                                        "texto": "Identidade do paciente confirmada",
                                                        "responsavel_papel": "enfermeiro",
                                                        "obrigatorio": true,
                                                        "feito": true,
                                                        "feito_por": 19,
                                                        "feito_por_nome": "Paulo Matos",
                                                        "feito_em": "2026-11-17T16:20:00+00:00"
                                                    },
                                                    {
                                                        "texto": "Análises pré-operatórias revistas",
                                                        "responsavel_papel": "cirurgiao",
                                                        "obrigatorio": true,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    },
                                                    {
                                                        "texto": "Fotografias pré-operatórias tiradas",
                                                        "responsavel_papel": "tecnico",
                                                        "obrigatorio": false,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    }
                                                ],
                                                "feitos": 3,
                                                "total": 3,
                                                "concluida_em": "2026-11-18T08:20:00+00:00"
                                            }
                                        ],
                                        "alta": null,
                                        "permissoes": {
                                            "registar": false,
                                            "abrir": false,
                                            "fechar": false,
                                            "enfermagem": false
                                        },
                                        "voz_palavras": {
                                            "1": [
                                                "um",
                                                "uma",
                                                "one",
                                                "uno",
                                                "un",
                                                "eins",
                                                "1"
                                            ],
                                            "2": [
                                                "dois",
                                                "duas",
                                                "two",
                                                "dos",
                                                "deux",
                                                "zwei",
                                                "2"
                                            ],
                                            "3": [
                                                "três",
                                                "tres",
                                                "three",
                                                "trois",
                                                "drei",
                                                "3"
                                            ],
                                            "4": [
                                                "quatro",
                                                "four",
                                                "cuatro",
                                                "quatre",
                                                "vier",
                                                "4"
                                            ],
                                            "desfazer": [
                                                "desfazer",
                                                "anular",
                                                "undo",
                                                "deshacer",
                                                "annuler",
                                                "rückgängig"
                                            ]
                                        },
                                        "atualizado_em": "2026-11-18T12:41:12+00:00",
                                        "efeitos": {
                                            "marcos": "ok",
                                            "honorarios": "ok",
                                            "stock": "ok",
                                            "episodio": "ok",
                                            "webhook": "ok"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "A sessão já está fechada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Business rule (validacao, sem_contagens, sinais_vitais_em_falta)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "validacao": {
                                        "summary": "validacao",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "validacao",
                                                "mensagem": "Escreva o número da cirurgia (CIR-2026-0214) para confirmar.",
                                                "campos": {
                                                    "confirmacao": "Escreva o número da cirurgia (CIR-2026-0214) para confirmar."
                                                }
                                            }
                                        }
                                    },
                                    "sem_contagens": {
                                        "summary": "sem_contagens",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "sem_contagens",
                                                "mensagem": "Não há contagens: registe os enxertos antes de fechar."
                                            }
                                        }
                                    },
                                    "sinais_vitais_em_falta": {
                                        "summary": "sinais_vitais_em_falta",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "sinais_vitais_em_falta",
                                                "mensagem": "Registe os sinais vitais antes de fechar."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/foto": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelFoto",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Intra-operative photo",
                "description": "Only with the session open (409). Requires access to the patient clinical record or «ficha.fotografias» edit. Image validated by content, stored as an encrypted clinical file and linked to the clinical gallery (accepted) when the planning module exists. With a zone or note, it also creates a nursing note. Returns a 15-minute signed link.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "zona": {
                                        "type": "string",
                                        "pattern": "^[a-z_]{2,30}$",
                                        "description": "Scalp zone (e.g. linha_frontal, coroa, dadora_occipital)."
                                    },
                                    "nota": {
                                        "type": "string",
                                        "maxLength": 4000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6FicheiroLigacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ficheiro_id": 7802,
                                        "url": "https://clinica.pt/api/v1/ficheiros/7802/conteudo?assinatura=8b1d0e&expira=1795432800"
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Abra primeiro a sessão."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/implantar": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelImplantarLote",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Batch implanted",
                "description": "Ends the batch time out of body (the first recorded time is kept) and allows correcting the quantity (0 to 5000). Missing batch → 404. Open session (409). On closing, batches not yet implanted close with the closing time.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "lote_id": {
                                        "type": "integer"
                                    },
                                    "quantidade": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 5000,
                                        "x-unidade": "enxertos"
                                    }
                                },
                                "required": [
                                    "lote_id"
                                ]
                            },
                            "example": {
                                "lote_id": 52,
                                "quantidade": 690
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Painel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "cirurgia": {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "estado": "em_curso",
                                            "estado_rotulo": "Em curso",
                                            "estado_tom": "marca",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "sala_nome": "Bloco 1",
                                            "tecnica": "FUE",
                                            "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                            "inicio_real": "2026-11-18T08:41:00+00:00",
                                            "fim_real": null,
                                            "fase_atual": "implantacao",
                                            "pausada": false,
                                            "pausada_em": null,
                                            "decorrido_seg": 14100,
                                            "peso_kg": 80,
                                            "consentimento": true
                                        },
                                        "fases": [
                                            {
                                                "fase": "admissao",
                                                "rotulo": "Admissão",
                                                "duracao_seg": 900,
                                                "inicio": "2026-11-18T08:41:00+00:00",
                                                "fim": "2026-11-18T08:56:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "desenho",
                                                "rotulo": "Desenho",
                                                "duracao_seg": 1200,
                                                "inicio": "2026-11-18T08:56:00+00:00",
                                                "fim": "2026-11-18T09:16:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "anestesia",
                                                "rotulo": "Anestesia",
                                                "duracao_seg": 600,
                                                "inicio": "2026-11-18T09:16:00+00:00",
                                                "fim": "2026-11-18T09:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "extracao",
                                                "rotulo": "Extração",
                                                "duracao_seg": 6900,
                                                "inicio": "2026-11-18T09:26:00+00:00",
                                                "fim": "2026-11-18T11:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "implantacao",
                                                "rotulo": "Implantação",
                                                "duracao_seg": 4500,
                                                "inicio": "2026-11-18T11:26:00+00:00",
                                                "fim": null,
                                                "atual": true,
                                                "feita": false
                                            },
                                            {
                                                "fase": "penso",
                                                "rotulo": "Penso",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            },
                                            {
                                                "fase": "alta",
                                                "rotulo": "Alta",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "operadores": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 410,
                                                    "2": 1260,
                                                    "3": 820,
                                                    "4": 140
                                                },
                                                "total": 2630,
                                                "cabelos": 5950,
                                                "cabelos_por_enxerto": 2.26
                                            },
                                            "implantacao": {
                                                "por_tipo": {
                                                    "1": 380,
                                                    "2": 1100,
                                                    "3": 700,
                                                    "4": 120
                                                },
                                                "total": 2300,
                                                "cabelos": 5160,
                                                "cabelos_por_enxerto": 2.24
                                            },
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "extracao": 2630,
                                                    "implantacao": 0,
                                                    "por_tipo": {
                                                        "1": 410,
                                                        "2": 1260,
                                                        "3": 820,
                                                        "4": 140
                                                    },
                                                    "por_hora": 780
                                                },
                                                {
                                                    "operador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "extracao": 0,
                                                    "implantacao": 2300,
                                                    "por_tipo": {
                                                        "1": 380,
                                                        "2": 1100,
                                                        "3": 700,
                                                        "4": 120
                                                    },
                                                    "por_hora": 920
                                                }
                                            ]
                                        },
                                        "planeado": 2850,
                                        "progresso": {
                                            "extraido_pct": 92,
                                            "implantado_pct": 81
                                        },
                                        "ultima_contagem": {
                                            "id": 90412,
                                            "tipo_uf": 2,
                                            "momento": "implantacao",
                                            "operador": "Marta Sousa",
                                            "criado_em": "2026-11-18T12:41:09+00:00"
                                        },
                                        "lotes": [
                                            {
                                                "id": 51,
                                                "lote": "L1",
                                                "quantidade": 600,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T09:50:00+00:00",
                                                "implantado_em": "2026-11-18T11:35:00+00:00",
                                                "horas_fora": 1.75,
                                                "estado": "ok"
                                            },
                                            {
                                                "id": 52,
                                                "lote": "L2",
                                                "quantidade": 700,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T10:30:00+00:00",
                                                "implantado_em": null,
                                                "horas_fora": 2.18,
                                                "estado": "ok"
                                            }
                                        ],
                                        "tempo_fora": {
                                            "alerta_h": 4,
                                            "maximo_h": 6
                                        },
                                        "transeccao": {
                                            "sessao_pct": 3.5,
                                            "amostras": 2,
                                            "observados": 200,
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "pct": 3.5,
                                                    "observados": 200
                                                }
                                            ]
                                        },
                                        "plano": {
                                            "id": 318,
                                            "versao": 3,
                                            "tecnica": "FUE",
                                            "enxertos_necessarios": 3200,
                                            "capacidade_sessao": 2850,
                                            "zonas": [
                                                {
                                                    "zona": "linha_frontal",
                                                    "rotulo": "Linha frontal",
                                                    "area_cm2": 15,
                                                    "densidade_alvo": 25,
                                                    "enxertos": 375
                                                },
                                                {
                                                    "zona": "frontal",
                                                    "rotulo": "Frontal",
                                                    "area_cm2": 60,
                                                    "densidade_alvo": 30,
                                                    "enxertos": 1800
                                                }
                                            ]
                                        },
                                        "enfermagem": {
                                            "visivel": true,
                                            "registos": [
                                                {
                                                    "id": 3302,
                                                    "tipo": "sinais_vitais",
                                                    "tipo_rotulo": "Sinais vitais",
                                                    "dados": {
                                                        "tas": 128,
                                                        "tad": 79,
                                                        "fc": 72,
                                                        "spo2": 98
                                                    },
                                                    "texto": "TA 128/79 mmHg · FC 72 bpm · SpO₂ 98 %",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T10:00:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                },
                                                {
                                                    "id": 3301,
                                                    "tipo": "farmaco",
                                                    "tipo_rotulo": "Fármaco",
                                                    "dados": {
                                                        "nome": "Lidocaína com adrenalina",
                                                        "dose": 34,
                                                        "unidade": "ml",
                                                        "concentracao_pct": 1,
                                                        "via": "local",
                                                        "hora": "09:05",
                                                        "lote": "LX2291",
                                                        "adrenalina": true,
                                                        "artigo_id": 58
                                                    },
                                                    "texto": "Lidocaína com adrenalina 34,00 ml (1,0 %) · Local · 09:05 · Lote LX2291 · com adrenalina",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T09:05:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                }
                                            ],
                                            "lidocaina": {
                                                "mg_total": 340,
                                                "mg_kg": 4.25,
                                                "limite": 7,
                                                "com_adrenalina": true,
                                                "aviso_pct": 80,
                                                "percentagem": 61,
                                                "estado": "ok",
                                                "peso_kg": 80
                                            },
                                            "sinais_vitais": {
                                                "ultimo_em": "2026-11-18T10:00:00+00:00",
                                                "intervalo_min": 60,
                                                "em_atraso": false
                                            },
                                            "dor_ultima": 2,
                                            "vias": [
                                                {
                                                    "valor": "local",
                                                    "rotulo": "Local"
                                                },
                                                {
                                                    "valor": "subcutanea",
                                                    "rotulo": "Subcutânea"
                                                },
                                                {
                                                    "valor": "oral",
                                                    "rotulo": "Oral"
                                                }
                                            ],
                                            "unidades": [
                                                "mg",
                                                "ml",
                                                "mcg",
                                                "UI",
                                                "g"
                                            ]
                                        },
                                        "checklists": [
                                            {
                                                "id": 611,
                                                "nome": "Verificação de segurança antes da cirurgia",
                                                "fase": "pre_operatorio",
                                                "fase_rotulo": "Pré-operatório",
                                                "estado": "concluida",
                                                "itens": [
                                                    {
                                                        "texto": "Identidade do paciente confirmada",
                                                        "responsavel_papel": "enfermeiro",
                                                        "obrigatorio": true,
                                                        "feito": true,
                                                        "feito_por": 19,
                                                        "feito_por_nome": "Paulo Matos",
                                                        "feito_em": "2026-11-17T16:20:00+00:00"
                                                    },
                                                    {
                                                        "texto": "Análises pré-operatórias revistas",
                                                        "responsavel_papel": "cirurgiao",
                                                        "obrigatorio": true,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    },
                                                    {
                                                        "texto": "Fotografias pré-operatórias tiradas",
                                                        "responsavel_papel": "tecnico",
                                                        "obrigatorio": false,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    }
                                                ],
                                                "feitos": 3,
                                                "total": 3,
                                                "concluida_em": "2026-11-18T08:20:00+00:00"
                                            }
                                        ],
                                        "alta": null,
                                        "permissoes": {
                                            "registar": true,
                                            "abrir": false,
                                            "fechar": true,
                                            "enfermagem": true
                                        },
                                        "voz_palavras": {
                                            "1": [
                                                "um",
                                                "uma",
                                                "one",
                                                "uno",
                                                "un",
                                                "eins",
                                                "1"
                                            ],
                                            "2": [
                                                "dois",
                                                "duas",
                                                "two",
                                                "dos",
                                                "deux",
                                                "zwei",
                                                "2"
                                            ],
                                            "3": [
                                                "três",
                                                "tres",
                                                "three",
                                                "trois",
                                                "drei",
                                                "3"
                                            ],
                                            "4": [
                                                "quatro",
                                                "four",
                                                "cuatro",
                                                "quatre",
                                                "vier",
                                                "4"
                                            ],
                                            "desfazer": [
                                                "desfazer",
                                                "anular",
                                                "undo",
                                                "deshacer",
                                                "annuler",
                                                "rückgängig"
                                            ]
                                        },
                                        "atualizado_em": "2026-11-18T12:41:12+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Abra primeiro a sessão."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/lote": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelNovoLote",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "New extracted batch",
                "description": "Creates the next batch (L1, L2, …) and starts the time out of body. Open session (409). The panel flags the batch «aviso» at the warning threshold and «perigo» at the maximum from Settings.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "quantidade": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 5000,
                                        "x-unidade": "enxertos"
                                    },
                                    "operador_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "quantidade"
                                ]
                            },
                            "example": {
                                "quantidade": 700,
                                "operador_id": 7
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Painel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "cirurgia": {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "estado": "em_curso",
                                            "estado_rotulo": "Em curso",
                                            "estado_tom": "marca",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "sala_nome": "Bloco 1",
                                            "tecnica": "FUE",
                                            "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                            "inicio_real": "2026-11-18T08:41:00+00:00",
                                            "fim_real": null,
                                            "fase_atual": "implantacao",
                                            "pausada": false,
                                            "pausada_em": null,
                                            "decorrido_seg": 14100,
                                            "peso_kg": 80,
                                            "consentimento": true
                                        },
                                        "fases": [
                                            {
                                                "fase": "admissao",
                                                "rotulo": "Admissão",
                                                "duracao_seg": 900,
                                                "inicio": "2026-11-18T08:41:00+00:00",
                                                "fim": "2026-11-18T08:56:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "desenho",
                                                "rotulo": "Desenho",
                                                "duracao_seg": 1200,
                                                "inicio": "2026-11-18T08:56:00+00:00",
                                                "fim": "2026-11-18T09:16:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "anestesia",
                                                "rotulo": "Anestesia",
                                                "duracao_seg": 600,
                                                "inicio": "2026-11-18T09:16:00+00:00",
                                                "fim": "2026-11-18T09:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "extracao",
                                                "rotulo": "Extração",
                                                "duracao_seg": 6900,
                                                "inicio": "2026-11-18T09:26:00+00:00",
                                                "fim": "2026-11-18T11:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "implantacao",
                                                "rotulo": "Implantação",
                                                "duracao_seg": 4500,
                                                "inicio": "2026-11-18T11:26:00+00:00",
                                                "fim": null,
                                                "atual": true,
                                                "feita": false
                                            },
                                            {
                                                "fase": "penso",
                                                "rotulo": "Penso",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            },
                                            {
                                                "fase": "alta",
                                                "rotulo": "Alta",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "operadores": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 410,
                                                    "2": 1260,
                                                    "3": 820,
                                                    "4": 140
                                                },
                                                "total": 2630,
                                                "cabelos": 5950,
                                                "cabelos_por_enxerto": 2.26
                                            },
                                            "implantacao": {
                                                "por_tipo": {
                                                    "1": 380,
                                                    "2": 1100,
                                                    "3": 700,
                                                    "4": 120
                                                },
                                                "total": 2300,
                                                "cabelos": 5160,
                                                "cabelos_por_enxerto": 2.24
                                            },
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "extracao": 2630,
                                                    "implantacao": 0,
                                                    "por_tipo": {
                                                        "1": 410,
                                                        "2": 1260,
                                                        "3": 820,
                                                        "4": 140
                                                    },
                                                    "por_hora": 780
                                                },
                                                {
                                                    "operador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "extracao": 0,
                                                    "implantacao": 2300,
                                                    "por_tipo": {
                                                        "1": 380,
                                                        "2": 1100,
                                                        "3": 700,
                                                        "4": 120
                                                    },
                                                    "por_hora": 920
                                                }
                                            ]
                                        },
                                        "planeado": 2850,
                                        "progresso": {
                                            "extraido_pct": 92,
                                            "implantado_pct": 81
                                        },
                                        "ultima_contagem": {
                                            "id": 90412,
                                            "tipo_uf": 2,
                                            "momento": "implantacao",
                                            "operador": "Marta Sousa",
                                            "criado_em": "2026-11-18T12:41:09+00:00"
                                        },
                                        "lotes": [
                                            {
                                                "id": 51,
                                                "lote": "L1",
                                                "quantidade": 600,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T09:50:00+00:00",
                                                "implantado_em": "2026-11-18T11:35:00+00:00",
                                                "horas_fora": 1.75,
                                                "estado": "ok"
                                            },
                                            {
                                                "id": 52,
                                                "lote": "L2",
                                                "quantidade": 700,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T10:30:00+00:00",
                                                "implantado_em": null,
                                                "horas_fora": 2.18,
                                                "estado": "ok"
                                            }
                                        ],
                                        "tempo_fora": {
                                            "alerta_h": 4,
                                            "maximo_h": 6
                                        },
                                        "transeccao": {
                                            "sessao_pct": 3.5,
                                            "amostras": 2,
                                            "observados": 200,
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "pct": 3.5,
                                                    "observados": 200
                                                }
                                            ]
                                        },
                                        "plano": {
                                            "id": 318,
                                            "versao": 3,
                                            "tecnica": "FUE",
                                            "enxertos_necessarios": 3200,
                                            "capacidade_sessao": 2850,
                                            "zonas": [
                                                {
                                                    "zona": "linha_frontal",
                                                    "rotulo": "Linha frontal",
                                                    "area_cm2": 15,
                                                    "densidade_alvo": 25,
                                                    "enxertos": 375
                                                },
                                                {
                                                    "zona": "frontal",
                                                    "rotulo": "Frontal",
                                                    "area_cm2": 60,
                                                    "densidade_alvo": 30,
                                                    "enxertos": 1800
                                                }
                                            ]
                                        },
                                        "enfermagem": {
                                            "visivel": true,
                                            "registos": [
                                                {
                                                    "id": 3302,
                                                    "tipo": "sinais_vitais",
                                                    "tipo_rotulo": "Sinais vitais",
                                                    "dados": {
                                                        "tas": 128,
                                                        "tad": 79,
                                                        "fc": 72,
                                                        "spo2": 98
                                                    },
                                                    "texto": "TA 128/79 mmHg · FC 72 bpm · SpO₂ 98 %",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T10:00:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                },
                                                {
                                                    "id": 3301,
                                                    "tipo": "farmaco",
                                                    "tipo_rotulo": "Fármaco",
                                                    "dados": {
                                                        "nome": "Lidocaína com adrenalina",
                                                        "dose": 34,
                                                        "unidade": "ml",
                                                        "concentracao_pct": 1,
                                                        "via": "local",
                                                        "hora": "09:05",
                                                        "lote": "LX2291",
                                                        "adrenalina": true,
                                                        "artigo_id": 58
                                                    },
                                                    "texto": "Lidocaína com adrenalina 34,00 ml (1,0 %) · Local · 09:05 · Lote LX2291 · com adrenalina",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T09:05:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                }
                                            ],
                                            "lidocaina": {
                                                "mg_total": 340,
                                                "mg_kg": 4.25,
                                                "limite": 7,
                                                "com_adrenalina": true,
                                                "aviso_pct": 80,
                                                "percentagem": 61,
                                                "estado": "ok",
                                                "peso_kg": 80
                                            },
                                            "sinais_vitais": {
                                                "ultimo_em": "2026-11-18T10:00:00+00:00",
                                                "intervalo_min": 60,
                                                "em_atraso": false
                                            },
                                            "dor_ultima": 2,
                                            "vias": [
                                                {
                                                    "valor": "local",
                                                    "rotulo": "Local"
                                                },
                                                {
                                                    "valor": "subcutanea",
                                                    "rotulo": "Subcutânea"
                                                },
                                                {
                                                    "valor": "oral",
                                                    "rotulo": "Oral"
                                                }
                                            ],
                                            "unidades": [
                                                "mg",
                                                "ml",
                                                "mcg",
                                                "UI",
                                                "g"
                                            ]
                                        },
                                        "checklists": [
                                            {
                                                "id": 611,
                                                "nome": "Verificação de segurança antes da cirurgia",
                                                "fase": "pre_operatorio",
                                                "fase_rotulo": "Pré-operatório",
                                                "estado": "concluida",
                                                "itens": [
                                                    {
                                                        "texto": "Identidade do paciente confirmada",
                                                        "responsavel_papel": "enfermeiro",
                                                        "obrigatorio": true,
                                                        "feito": true,
                                                        "feito_por": 19,
                                                        "feito_por_nome": "Paulo Matos",
                                                        "feito_em": "2026-11-17T16:20:00+00:00"
                                                    },
                                                    {
                                                        "texto": "Análises pré-operatórias revistas",
                                                        "responsavel_papel": "cirurgiao",
                                                        "obrigatorio": true,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    },
                                                    {
                                                        "texto": "Fotografias pré-operatórias tiradas",
                                                        "responsavel_papel": "tecnico",
                                                        "obrigatorio": false,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    }
                                                ],
                                                "feitos": 3,
                                                "total": 3,
                                                "concluida_em": "2026-11-18T08:20:00+00:00"
                                            }
                                        ],
                                        "alta": null,
                                        "permissoes": {
                                            "registar": true,
                                            "abrir": false,
                                            "fechar": true,
                                            "enfermagem": true
                                        },
                                        "voz_palavras": {
                                            "1": [
                                                "um",
                                                "uma",
                                                "one",
                                                "uno",
                                                "un",
                                                "eins",
                                                "1"
                                            ],
                                            "2": [
                                                "dois",
                                                "duas",
                                                "two",
                                                "dos",
                                                "deux",
                                                "zwei",
                                                "2"
                                            ],
                                            "3": [
                                                "três",
                                                "tres",
                                                "three",
                                                "trois",
                                                "drei",
                                                "3"
                                            ],
                                            "4": [
                                                "quatro",
                                                "four",
                                                "cuatro",
                                                "quatre",
                                                "vier",
                                                "4"
                                            ],
                                            "desfazer": [
                                                "desfazer",
                                                "anular",
                                                "undo",
                                                "deshacer",
                                                "annuler",
                                                "rückgängig"
                                            ]
                                        },
                                        "atualizado_em": "2026-11-18T12:41:12+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Abra primeiro a sessão."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/motor": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelMotor",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Record an extraction motor reading",
                "description": "Session in progress or closed. Values validated by range. «aviso» or «falha» notifies the surgical team. Immutable record (voided with a reason). Returns the updated readings and alerts.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "dados": {
                                        "type": "object",
                                        "properties": {
                                            "equipamento_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "hora": {
                                                "type": "string",
                                                "description": "HH:MM on the surgery day (empty = now)."
                                            },
                                            "velocidade_rpm": {
                                                "type": [
                                                    "number",
                                                    "null"
                                                ],
                                                "x-unidade": "rpm"
                                            },
                                            "binario_ncm": {
                                                "type": [
                                                    "number",
                                                    "null"
                                                ],
                                                "x-unidade": "N·cm"
                                            },
                                            "modo": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "enum": [
                                                    "rotacao",
                                                    "oscilacao",
                                                    "vibracao",
                                                    null
                                                ]
                                            },
                                            "punch_mm": {
                                                "type": [
                                                    "number",
                                                    "null"
                                                ],
                                                "x-unidade": "mm"
                                            },
                                            "profundidade_mm": {
                                                "type": [
                                                    "number",
                                                    "null"
                                                ],
                                                "x-unidade": "mm"
                                            },
                                            "temperatura_c": {
                                                "type": [
                                                    "number",
                                                    "null"
                                                ],
                                                "x-unidade": "°C"
                                            },
                                            "estado": {
                                                "type": "string",
                                                "enum": [
                                                    "ok",
                                                    "aviso",
                                                    "falha"
                                                ]
                                            },
                                            "nota": {
                                                "type": "string",
                                                "maxLength": 255
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "dados"
                                ]
                            },
                            "example": {
                                "dados": {
                                    "equipamento_id": 14,
                                    "hora": "10:42",
                                    "velocidade_rpm": 2800,
                                    "binario_ncm": 12.5,
                                    "modo": "oscilacao",
                                    "punch_mm": 0.85,
                                    "estado": "aviso",
                                    "nota": "Aquecimento da peça de mão"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "motores": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "motores": {
                                            "visivel": true,
                                            "leituras": [],
                                            "alertas": []
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Abra primeiro a sessão."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/motor_anular": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelMotorAnular",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Void a motor reading",
                "description": "With a reason (at least 3 characters); the reading keeps the author and reason.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "leitura_id": {
                                        "type": "integer"
                                    },
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 3,
                                        "maxLength": 255
                                    }
                                },
                                "required": [
                                    "leitura_id",
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "motores": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/motores/importar": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelMotoresImportar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Import motor readings (CSV)",
                "description": "CSV exported by the motor (up to 2 MB, 500 lines, «;» or «,» separator, optional header row). Invalid lines are skipped and counted. Limit: 10 per 10 minutes.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "equipamento_id": {
                                        "type": "integer"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "importadas": {
                                                    "type": "integer"
                                                },
                                                "ignoradas": {
                                                    "type": "integer"
                                                },
                                                "motores": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "importadas": 42,
                                        "ignoradas": 1,
                                        "motores": {
                                            "visivel": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/pausa": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelPausa",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Pause or resume",
                "description": "Open session (409). The session and phase timers deduct the paused time. Repeated requests change nothing.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "pausar": {
                                        "type": "boolean",
                                        "description": "true pauses; false resumes."
                                    }
                                },
                                "required": [
                                    "pausar"
                                ]
                            },
                            "example": {
                                "pausar": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Painel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "cirurgia": {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "estado": "em_curso",
                                            "estado_rotulo": "Em curso",
                                            "estado_tom": "marca",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "sala_nome": "Bloco 1",
                                            "tecnica": "FUE",
                                            "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                            "inicio_real": "2026-11-18T08:41:00+00:00",
                                            "fim_real": null,
                                            "fase_atual": "implantacao",
                                            "pausada": true,
                                            "pausada_em": "2026-11-18T12:45:00+00:00",
                                            "decorrido_seg": 14100,
                                            "peso_kg": 80,
                                            "consentimento": true
                                        },
                                        "fases": [
                                            {
                                                "fase": "admissao",
                                                "rotulo": "Admissão",
                                                "duracao_seg": 900,
                                                "inicio": "2026-11-18T08:41:00+00:00",
                                                "fim": "2026-11-18T08:56:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "desenho",
                                                "rotulo": "Desenho",
                                                "duracao_seg": 1200,
                                                "inicio": "2026-11-18T08:56:00+00:00",
                                                "fim": "2026-11-18T09:16:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "anestesia",
                                                "rotulo": "Anestesia",
                                                "duracao_seg": 600,
                                                "inicio": "2026-11-18T09:16:00+00:00",
                                                "fim": "2026-11-18T09:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "extracao",
                                                "rotulo": "Extração",
                                                "duracao_seg": 6900,
                                                "inicio": "2026-11-18T09:26:00+00:00",
                                                "fim": "2026-11-18T11:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "implantacao",
                                                "rotulo": "Implantação",
                                                "duracao_seg": 4500,
                                                "inicio": "2026-11-18T11:26:00+00:00",
                                                "fim": null,
                                                "atual": true,
                                                "feita": false
                                            },
                                            {
                                                "fase": "penso",
                                                "rotulo": "Penso",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            },
                                            {
                                                "fase": "alta",
                                                "rotulo": "Alta",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "operadores": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 410,
                                                    "2": 1260,
                                                    "3": 820,
                                                    "4": 140
                                                },
                                                "total": 2630,
                                                "cabelos": 5950,
                                                "cabelos_por_enxerto": 2.26
                                            },
                                            "implantacao": {
                                                "por_tipo": {
                                                    "1": 380,
                                                    "2": 1100,
                                                    "3": 700,
                                                    "4": 120
                                                },
                                                "total": 2300,
                                                "cabelos": 5160,
                                                "cabelos_por_enxerto": 2.24
                                            },
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "extracao": 2630,
                                                    "implantacao": 0,
                                                    "por_tipo": {
                                                        "1": 410,
                                                        "2": 1260,
                                                        "3": 820,
                                                        "4": 140
                                                    },
                                                    "por_hora": 780
                                                },
                                                {
                                                    "operador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "extracao": 0,
                                                    "implantacao": 2300,
                                                    "por_tipo": {
                                                        "1": 380,
                                                        "2": 1100,
                                                        "3": 700,
                                                        "4": 120
                                                    },
                                                    "por_hora": 920
                                                }
                                            ]
                                        },
                                        "planeado": 2850,
                                        "progresso": {
                                            "extraido_pct": 92,
                                            "implantado_pct": 81
                                        },
                                        "ultima_contagem": {
                                            "id": 90412,
                                            "tipo_uf": 2,
                                            "momento": "implantacao",
                                            "operador": "Marta Sousa",
                                            "criado_em": "2026-11-18T12:41:09+00:00"
                                        },
                                        "lotes": [
                                            {
                                                "id": 51,
                                                "lote": "L1",
                                                "quantidade": 600,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T09:50:00+00:00",
                                                "implantado_em": "2026-11-18T11:35:00+00:00",
                                                "horas_fora": 1.75,
                                                "estado": "ok"
                                            },
                                            {
                                                "id": 52,
                                                "lote": "L2",
                                                "quantidade": 700,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T10:30:00+00:00",
                                                "implantado_em": null,
                                                "horas_fora": 2.18,
                                                "estado": "ok"
                                            }
                                        ],
                                        "tempo_fora": {
                                            "alerta_h": 4,
                                            "maximo_h": 6
                                        },
                                        "transeccao": {
                                            "sessao_pct": 3.5,
                                            "amostras": 2,
                                            "observados": 200,
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "pct": 3.5,
                                                    "observados": 200
                                                }
                                            ]
                                        },
                                        "plano": {
                                            "id": 318,
                                            "versao": 3,
                                            "tecnica": "FUE",
                                            "enxertos_necessarios": 3200,
                                            "capacidade_sessao": 2850,
                                            "zonas": [
                                                {
                                                    "zona": "linha_frontal",
                                                    "rotulo": "Linha frontal",
                                                    "area_cm2": 15,
                                                    "densidade_alvo": 25,
                                                    "enxertos": 375
                                                },
                                                {
                                                    "zona": "frontal",
                                                    "rotulo": "Frontal",
                                                    "area_cm2": 60,
                                                    "densidade_alvo": 30,
                                                    "enxertos": 1800
                                                }
                                            ]
                                        },
                                        "enfermagem": {
                                            "visivel": true,
                                            "registos": [
                                                {
                                                    "id": 3302,
                                                    "tipo": "sinais_vitais",
                                                    "tipo_rotulo": "Sinais vitais",
                                                    "dados": {
                                                        "tas": 128,
                                                        "tad": 79,
                                                        "fc": 72,
                                                        "spo2": 98
                                                    },
                                                    "texto": "TA 128/79 mmHg · FC 72 bpm · SpO₂ 98 %",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T10:00:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                },
                                                {
                                                    "id": 3301,
                                                    "tipo": "farmaco",
                                                    "tipo_rotulo": "Fármaco",
                                                    "dados": {
                                                        "nome": "Lidocaína com adrenalina",
                                                        "dose": 34,
                                                        "unidade": "ml",
                                                        "concentracao_pct": 1,
                                                        "via": "local",
                                                        "hora": "09:05",
                                                        "lote": "LX2291",
                                                        "adrenalina": true,
                                                        "artigo_id": 58
                                                    },
                                                    "texto": "Lidocaína com adrenalina 34,00 ml (1,0 %) · Local · 09:05 · Lote LX2291 · com adrenalina",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T09:05:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                }
                                            ],
                                            "lidocaina": {
                                                "mg_total": 340,
                                                "mg_kg": 4.25,
                                                "limite": 7,
                                                "com_adrenalina": true,
                                                "aviso_pct": 80,
                                                "percentagem": 61,
                                                "estado": "ok",
                                                "peso_kg": 80
                                            },
                                            "sinais_vitais": {
                                                "ultimo_em": "2026-11-18T10:00:00+00:00",
                                                "intervalo_min": 60,
                                                "em_atraso": false
                                            },
                                            "dor_ultima": 2,
                                            "vias": [
                                                {
                                                    "valor": "local",
                                                    "rotulo": "Local"
                                                },
                                                {
                                                    "valor": "subcutanea",
                                                    "rotulo": "Subcutânea"
                                                },
                                                {
                                                    "valor": "oral",
                                                    "rotulo": "Oral"
                                                }
                                            ],
                                            "unidades": [
                                                "mg",
                                                "ml",
                                                "mcg",
                                                "UI",
                                                "g"
                                            ]
                                        },
                                        "checklists": [
                                            {
                                                "id": 611,
                                                "nome": "Verificação de segurança antes da cirurgia",
                                                "fase": "pre_operatorio",
                                                "fase_rotulo": "Pré-operatório",
                                                "estado": "concluida",
                                                "itens": [
                                                    {
                                                        "texto": "Identidade do paciente confirmada",
                                                        "responsavel_papel": "enfermeiro",
                                                        "obrigatorio": true,
                                                        "feito": true,
                                                        "feito_por": 19,
                                                        "feito_por_nome": "Paulo Matos",
                                                        "feito_em": "2026-11-17T16:20:00+00:00"
                                                    },
                                                    {
                                                        "texto": "Análises pré-operatórias revistas",
                                                        "responsavel_papel": "cirurgiao",
                                                        "obrigatorio": true,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    },
                                                    {
                                                        "texto": "Fotografias pré-operatórias tiradas",
                                                        "responsavel_papel": "tecnico",
                                                        "obrigatorio": false,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    }
                                                ],
                                                "feitos": 3,
                                                "total": 3,
                                                "concluida_em": "2026-11-18T08:20:00+00:00"
                                            }
                                        ],
                                        "alta": null,
                                        "permissoes": {
                                            "registar": true,
                                            "abrir": false,
                                            "fechar": true,
                                            "enfermagem": true
                                        },
                                        "voz_palavras": {
                                            "1": [
                                                "um",
                                                "uma",
                                                "one",
                                                "uno",
                                                "un",
                                                "eins",
                                                "1"
                                            ],
                                            "2": [
                                                "dois",
                                                "duas",
                                                "two",
                                                "dos",
                                                "deux",
                                                "zwei",
                                                "2"
                                            ],
                                            "3": [
                                                "três",
                                                "tres",
                                                "three",
                                                "trois",
                                                "drei",
                                                "3"
                                            ],
                                            "4": [
                                                "quatro",
                                                "four",
                                                "cuatro",
                                                "quatre",
                                                "vier",
                                                "4"
                                            ],
                                            "desfazer": [
                                                "desfazer",
                                                "anular",
                                                "undo",
                                                "deshacer",
                                                "annuler",
                                                "rückgängig"
                                            ]
                                        },
                                        "atualizado_em": "2026-11-18T12:41:12+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Abra primeiro a sessão."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/peso": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelPeso",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Patient weight",
                "description": "Between 25 and 300 kg (one decimal place). Needed to compute the cumulative lidocaine dose in mg/kg; without weight and with lidocaine recorded, the alert status is «sem_peso». Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "peso_kg": {
                                        "type": "number",
                                        "minimum": 25,
                                        "maximum": 300,
                                        "x-unidade": "kg"
                                    }
                                },
                                "required": [
                                    "peso_kg"
                                ]
                            },
                            "example": {
                                "peso_kg": 80
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Painel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "cirurgia": {
                                            "id": 214,
                                            "numero": "CIR-2026-0214",
                                            "estado": "em_curso",
                                            "estado_rotulo": "Em curso",
                                            "estado_tom": "marca",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "sala_nome": "Bloco 1",
                                            "tecnica": "FUE",
                                            "inicio_previsto": "2026-11-18T08:30:00+00:00",
                                            "inicio_real": "2026-11-18T08:41:00+00:00",
                                            "fim_real": null,
                                            "fase_atual": "implantacao",
                                            "pausada": false,
                                            "pausada_em": null,
                                            "decorrido_seg": 14100,
                                            "peso_kg": 80,
                                            "consentimento": true
                                        },
                                        "fases": [
                                            {
                                                "fase": "admissao",
                                                "rotulo": "Admissão",
                                                "duracao_seg": 900,
                                                "inicio": "2026-11-18T08:41:00+00:00",
                                                "fim": "2026-11-18T08:56:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "desenho",
                                                "rotulo": "Desenho",
                                                "duracao_seg": 1200,
                                                "inicio": "2026-11-18T08:56:00+00:00",
                                                "fim": "2026-11-18T09:16:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "anestesia",
                                                "rotulo": "Anestesia",
                                                "duracao_seg": 600,
                                                "inicio": "2026-11-18T09:16:00+00:00",
                                                "fim": "2026-11-18T09:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "extracao",
                                                "rotulo": "Extração",
                                                "duracao_seg": 6900,
                                                "inicio": "2026-11-18T09:26:00+00:00",
                                                "fim": "2026-11-18T11:26:00+00:00",
                                                "atual": false,
                                                "feita": true
                                            },
                                            {
                                                "fase": "implantacao",
                                                "rotulo": "Implantação",
                                                "duracao_seg": 4500,
                                                "inicio": "2026-11-18T11:26:00+00:00",
                                                "fim": null,
                                                "atual": true,
                                                "feita": false
                                            },
                                            {
                                                "fase": "penso",
                                                "rotulo": "Penso",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            },
                                            {
                                                "fase": "alta",
                                                "rotulo": "Alta",
                                                "duracao_seg": 0,
                                                "inicio": null,
                                                "fim": null,
                                                "atual": false,
                                                "feita": false
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "operadores": [
                                            {
                                                "utilizador_id": 7,
                                                "nome": "Inês Valente",
                                                "cor": "#7A4E9C",
                                                "papel": "cirurgiao",
                                                "papel_rotulo": "Cirurgião",
                                                "honorarios_valor": 1200
                                            },
                                            {
                                                "utilizador_id": 15,
                                                "nome": "Marta Sousa",
                                                "cor": "#C0743A",
                                                "papel": "assistente",
                                                "papel_rotulo": "Assistente"
                                            },
                                            {
                                                "utilizador_id": 19,
                                                "nome": "Paulo Matos",
                                                "cor": "#3A7BC0",
                                                "papel": "enfermeiro",
                                                "papel_rotulo": "Enfermeiro"
                                            }
                                        ],
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 410,
                                                    "2": 1260,
                                                    "3": 820,
                                                    "4": 140
                                                },
                                                "total": 2630,
                                                "cabelos": 5950,
                                                "cabelos_por_enxerto": 2.26
                                            },
                                            "implantacao": {
                                                "por_tipo": {
                                                    "1": 380,
                                                    "2": 1100,
                                                    "3": 700,
                                                    "4": 120
                                                },
                                                "total": 2300,
                                                "cabelos": 5160,
                                                "cabelos_por_enxerto": 2.24
                                            },
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "cor": "#7A4E9C",
                                                    "extracao": 2630,
                                                    "implantacao": 0,
                                                    "por_tipo": {
                                                        "1": 410,
                                                        "2": 1260,
                                                        "3": 820,
                                                        "4": 140
                                                    },
                                                    "por_hora": 780
                                                },
                                                {
                                                    "operador_id": 15,
                                                    "nome": "Marta Sousa",
                                                    "cor": "#C0743A",
                                                    "extracao": 0,
                                                    "implantacao": 2300,
                                                    "por_tipo": {
                                                        "1": 380,
                                                        "2": 1100,
                                                        "3": 700,
                                                        "4": 120
                                                    },
                                                    "por_hora": 920
                                                }
                                            ]
                                        },
                                        "planeado": 2850,
                                        "progresso": {
                                            "extraido_pct": 92,
                                            "implantado_pct": 81
                                        },
                                        "ultima_contagem": {
                                            "id": 90412,
                                            "tipo_uf": 2,
                                            "momento": "implantacao",
                                            "operador": "Marta Sousa",
                                            "criado_em": "2026-11-18T12:41:09+00:00"
                                        },
                                        "lotes": [
                                            {
                                                "id": 51,
                                                "lote": "L1",
                                                "quantidade": 600,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T09:50:00+00:00",
                                                "implantado_em": "2026-11-18T11:35:00+00:00",
                                                "horas_fora": 1.75,
                                                "estado": "ok"
                                            },
                                            {
                                                "id": 52,
                                                "lote": "L2",
                                                "quantidade": 700,
                                                "operador": "Inês Valente",
                                                "extraido_em": "2026-11-18T10:30:00+00:00",
                                                "implantado_em": null,
                                                "horas_fora": 2.18,
                                                "estado": "ok"
                                            }
                                        ],
                                        "tempo_fora": {
                                            "alerta_h": 4,
                                            "maximo_h": 6
                                        },
                                        "transeccao": {
                                            "sessao_pct": 3.5,
                                            "amostras": 2,
                                            "observados": 200,
                                            "por_operador": [
                                                {
                                                    "operador_id": 7,
                                                    "nome": "Inês Valente",
                                                    "pct": 3.5,
                                                    "observados": 200
                                                }
                                            ]
                                        },
                                        "plano": {
                                            "id": 318,
                                            "versao": 3,
                                            "tecnica": "FUE",
                                            "enxertos_necessarios": 3200,
                                            "capacidade_sessao": 2850,
                                            "zonas": [
                                                {
                                                    "zona": "linha_frontal",
                                                    "rotulo": "Linha frontal",
                                                    "area_cm2": 15,
                                                    "densidade_alvo": 25,
                                                    "enxertos": 375
                                                },
                                                {
                                                    "zona": "frontal",
                                                    "rotulo": "Frontal",
                                                    "area_cm2": 60,
                                                    "densidade_alvo": 30,
                                                    "enxertos": 1800
                                                }
                                            ]
                                        },
                                        "enfermagem": {
                                            "visivel": true,
                                            "registos": [
                                                {
                                                    "id": 3302,
                                                    "tipo": "sinais_vitais",
                                                    "tipo_rotulo": "Sinais vitais",
                                                    "dados": {
                                                        "tas": 128,
                                                        "tad": 79,
                                                        "fc": 72,
                                                        "spo2": 98
                                                    },
                                                    "texto": "TA 128/79 mmHg · FC 72 bpm · SpO₂ 98 %",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T10:00:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                },
                                                {
                                                    "id": 3301,
                                                    "tipo": "farmaco",
                                                    "tipo_rotulo": "Fármaco",
                                                    "dados": {
                                                        "nome": "Lidocaína com adrenalina",
                                                        "dose": 34,
                                                        "unidade": "ml",
                                                        "concentracao_pct": 1,
                                                        "via": "local",
                                                        "hora": "09:05",
                                                        "lote": "LX2291",
                                                        "adrenalina": true,
                                                        "artigo_id": 58
                                                    },
                                                    "texto": "Lidocaína com adrenalina 34,00 ml (1,0 %) · Local · 09:05 · Lote LX2291 · com adrenalina",
                                                    "autor": "Paulo Matos",
                                                    "registado_em": "2026-11-18T09:05:00+00:00",
                                                    "anulado": false,
                                                    "motivo_anulacao": null
                                                }
                                            ],
                                            "lidocaina": {
                                                "mg_total": 340,
                                                "mg_kg": 4.25,
                                                "limite": 7,
                                                "com_adrenalina": true,
                                                "aviso_pct": 80,
                                                "percentagem": 61,
                                                "estado": "ok",
                                                "peso_kg": 80
                                            },
                                            "sinais_vitais": {
                                                "ultimo_em": "2026-11-18T10:00:00+00:00",
                                                "intervalo_min": 60,
                                                "em_atraso": false
                                            },
                                            "dor_ultima": 2,
                                            "vias": [
                                                {
                                                    "valor": "local",
                                                    "rotulo": "Local"
                                                },
                                                {
                                                    "valor": "subcutanea",
                                                    "rotulo": "Subcutânea"
                                                },
                                                {
                                                    "valor": "oral",
                                                    "rotulo": "Oral"
                                                }
                                            ],
                                            "unidades": [
                                                "mg",
                                                "ml",
                                                "mcg",
                                                "UI",
                                                "g"
                                            ]
                                        },
                                        "checklists": [
                                            {
                                                "id": 611,
                                                "nome": "Verificação de segurança antes da cirurgia",
                                                "fase": "pre_operatorio",
                                                "fase_rotulo": "Pré-operatório",
                                                "estado": "concluida",
                                                "itens": [
                                                    {
                                                        "texto": "Identidade do paciente confirmada",
                                                        "responsavel_papel": "enfermeiro",
                                                        "obrigatorio": true,
                                                        "feito": true,
                                                        "feito_por": 19,
                                                        "feito_por_nome": "Paulo Matos",
                                                        "feito_em": "2026-11-17T16:20:00+00:00"
                                                    },
                                                    {
                                                        "texto": "Análises pré-operatórias revistas",
                                                        "responsavel_papel": "cirurgiao",
                                                        "obrigatorio": true,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    },
                                                    {
                                                        "texto": "Fotografias pré-operatórias tiradas",
                                                        "responsavel_papel": "tecnico",
                                                        "obrigatorio": false,
                                                        "feito": false,
                                                        "feito_por": null,
                                                        "feito_por_nome": null,
                                                        "feito_em": null
                                                    }
                                                ],
                                                "feitos": 3,
                                                "total": 3,
                                                "concluida_em": "2026-11-18T08:20:00+00:00"
                                            }
                                        ],
                                        "alta": null,
                                        "permissoes": {
                                            "registar": true,
                                            "abrir": false,
                                            "fechar": true,
                                            "enfermagem": true
                                        },
                                        "voz_palavras": {
                                            "1": [
                                                "um",
                                                "uma",
                                                "one",
                                                "uno",
                                                "un",
                                                "eins",
                                                "1"
                                            ],
                                            "2": [
                                                "dois",
                                                "duas",
                                                "two",
                                                "dos",
                                                "deux",
                                                "zwei",
                                                "2"
                                            ],
                                            "3": [
                                                "três",
                                                "tres",
                                                "three",
                                                "trois",
                                                "drei",
                                                "3"
                                            ],
                                            "4": [
                                                "quatro",
                                                "four",
                                                "cuatro",
                                                "quatre",
                                                "vier",
                                                "4"
                                            ],
                                            "desfazer": [
                                                "desfazer",
                                                "anular",
                                                "undo",
                                                "deshacer",
                                                "annuler",
                                                "rückgängig"
                                            ]
                                        },
                                        "atualizado_em": "2026-11-18T12:41:12+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/painel/{id}/voz": {
            "post": {
                "tags": [
                    "Painel cirúrgico"
                ],
                "operationId": "m6PainelVoz",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Surgery identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Voice counting (audio chunk)",
                "description": "A short audio chunk (WAV PCM 16-bit, 16 kHz, mono, up to ~12 s / 600 KB) captured by the tablet when it detects speech. The server transcribes it with the «contagem_voz» AI use (local service first; the external fallback only with the patient-data switch), interprets the counting words in the given language («one»…«four», «single»…«quadruple», digits, «undo») and records each one as a count with origin «voz» (up to 12 per chunk; room conversation and echoes of the context phrase are ignored). Audio is never stored; «ouvido» is only returned when counts were recorded. Errors: 409 session not open, 503 «voz_indisponivel», 422 format/duration. Transcription failure: 200 with «ok»: false and «erro». Limit: 300 per minute.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "WAV 16 kHz mono."
                                    },
                                    "momento": {
                                        "type": "string",
                                        "enum": [
                                            "extracao",
                                            "implantacao"
                                        ]
                                    },
                                    "operador_id": {
                                        "type": "integer"
                                    },
                                    "lote": {
                                        "type": "string",
                                        "maxLength": 20
                                    },
                                    "lingua": {
                                        "type": "string",
                                        "description": "Language of the words (pt-PT, pt-BR, en, es, fr, de)."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "ouvido": {
                                                    "type": "string"
                                                },
                                                "comandos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "enum": [
                                                            "1",
                                                            "2",
                                                            "3",
                                                            "4",
                                                            "desfazer"
                                                        ]
                                                    }
                                                },
                                                "aplicados": {
                                                    "type": "integer"
                                                },
                                                "fornecedor": {
                                                    "type": "string"
                                                },
                                                "erro": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "contagens": {
                                                    "type": "object"
                                                },
                                                "progresso": {
                                                    "type": "object"
                                                },
                                                "ultima_contagem": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "ouvido": "Dois. Dois.",
                                        "comandos": [
                                            "2",
                                            "2"
                                        ],
                                        "aplicados": 2,
                                        "fornecedor": "ollama",
                                        "erro": null,
                                        "contagens": {
                                            "extracao": {
                                                "por_tipo": {
                                                    "1": 120,
                                                    "2": 342,
                                                    "3": 110,
                                                    "4": 12
                                                },
                                                "total": 584,
                                                "cabelos": 1182,
                                                "cabelos_por_enxerto": 2.02
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Abra primeiro a sessão."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/bloco/por-agendar": {
            "get": {
                "tags": [
                    "Mapa de cirurgias"
                ],
                "operationId": "m6CirurgiasPorAgendar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "bloco.mapa",
                "x-anagen-nivel": "ver",
                "summary": "Pre-booked surgeries without a date",
                "description": "Pre-booked (accepted proposal with deposit, or created manually) still without a date, by age (up to 100), to drag onto the map.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M6CirurgiaPorAgendar"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 221,
                                            "numero": "CIR-2026-0221",
                                            "paciente_id": 1311,
                                            "paciente_nome": "Hugo Ferreira",
                                            "tecnica": "DHI",
                                            "enxertos_planeados": 2200,
                                            "sinal_pago": true,
                                            "desde": "2026-10-25T15:42:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/chat/canais": {
            "get": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "listarCanais",
                "summary": "Channels of the current person",
                "description": "Only channels the person belongs to (auto-joins their department channels), with unread count, mentions and last message. meta.atualizar_segundos is the refresh interval.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "arquivados",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "0",
                                "1"
                            ]
                        },
                        "description": "Include archived."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Canal"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "nao_lidas": {
                                                    "type": "integer"
                                                },
                                                "convidado_externo": {
                                                    "type": "boolean"
                                                },
                                                "atualizar_segundos": {
                                                    "type": "integer"
                                                },
                                                "departamentos_geriveis": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "Departments where the person may create channels: all with the «all» scope, their own with the «department» scope, none otherwise."
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 7,
                                            "tipo": "departamento",
                                            "tipo_rotulo": "Departamento",
                                            "nome": "Enfermagem",
                                            "nao_lidas": 3,
                                            "mencoes": 1,
                                            "silenciado": false,
                                            "ultima": {
                                                "texto": "O paciente das 14 h chegou.",
                                                "autor_nome": "Ana Sousa",
                                                "em": "2026-10-28T13:58:00+00:00"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "criarCanal",
                "summary": "Create channel",
                "description": "Types: grupo, paciente (requires patient identification access), cirurgia (requires surgery map access) and departamento (chat administrators only). The creator becomes manager.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/NovoCanal"
                            },
                            "example": {
                                "tipo": "paciente",
                                "paciente_id": 41,
                                "membros": [
                                    4,
                                    9,
                                    12
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CanalDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/chat/canais/{id}": {
            "get": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "obterCanal",
                "summary": "Channel with members and read state",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CanalDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/chat/canais/{id}/arquivar": {
            "post": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "arquivarCanal",
                "summary": "Archive/reopen channel (manager)",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "arquivar": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "arquivar": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/chat/canais/{id}/lido": {
            "post": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "marcarCanalLido",
                "summary": "Mark as read up to a message",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ate"
                                ],
                                "properties": {
                                    "ate": {
                                        "type": "integer"
                                    }
                                }
                            },
                            "example": {
                                "ate": 1204
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/chat/canais/{id}/membros": {
            "post": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "acrescentarMembros",
                "summary": "Add members or an external guest",
                "description": "Channel manager (or chat administrator) only. With externo=true the person is limited to THIS channel (422 if already in another).",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "membros"
                                ],
                                "properties": {
                                    "membros": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    },
                                    "externo": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "membros": [
                                    31
                                ],
                                "externo": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CanalDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/chat/canais/{id}/membros/{utilizador}": {
            "delete": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "retirarMembro",
                "summary": "Remove member (or leave)",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "name": "utilizador",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Person"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/chat/canais/{id}/mensagens": {
            "get": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "listarMensagens",
                "summary": "Messages (latest, older or new)",
                "description": "No parameters: the latest. «antes=<id>»: older ones (scroll up). «depois=<id>»: new ones plus those changed in the last 2 minutes (refresh). «leituras» gives each member's last read id (read receipts).",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "name": "depois",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Id of the last known message."
                    },
                    {
                        "name": "antes",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Id of the first known message."
                    },
                    {
                        "name": "por_pagina",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "maximum": 100,
                            "default": 40
                        },
                        "description": "How many."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MensagensDoCanal"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "mensagens": [
                                            {
                                                "id": 1204,
                                                "canal_id": 7,
                                                "autor_id": 4,
                                                "autor_nome": "Ana Sousa",
                                                "minha": false,
                                                "sistema": false,
                                                "corpo": "@Inês o paciente das 14 h chegou.",
                                                "apagada": false,
                                                "editada": false,
                                                "mencoes": [
                                                    9
                                                ],
                                                "mencionado": true,
                                                "anexos": [],
                                                "tarefa_id": null,
                                                "lido_por": 3,
                                                "lido_por_todos": false,
                                                "pode_editar": false,
                                                "criado_em": "2026-10-28T13:58:00+00:00"
                                            }
                                        ],
                                        "leituras": {
                                            "4": 1204,
                                            "9": 1198
                                        },
                                        "ha_mais": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "enviarMensagem",
                "summary": "Send message",
                "description": "Text up to the configured limit and/or attachments (ids of files uploaded by the sender through POST /ficheiros with category «chat»). «@Name» mentions channel members, who get a notification without the message text. The body is stored encrypted.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "corpo": {
                                        "type": "string",
                                        "maxLength": 20000
                                    },
                                    "anexos": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        },
                                        "maxItems": 10
                                    },
                                    "responde_a_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "corpo": "@Inês o paciente das 14 h chegou.",
                                "anexos": []
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Mensagem"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 1204,
                                        "canal_id": 7,
                                        "autor_id": 4,
                                        "autor_nome": "Ana Sousa",
                                        "minha": false,
                                        "sistema": false,
                                        "corpo": "@Inês o paciente das 14 h chegou.",
                                        "apagada": false,
                                        "editada": false,
                                        "mencoes": [
                                            9
                                        ],
                                        "mencionado": true,
                                        "anexos": [],
                                        "tarefa_id": null,
                                        "lido_por": 3,
                                        "lido_por_todos": false,
                                        "pode_editar": false,
                                        "criado_em": "2026-10-28T13:58:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/chat/canais/{id}/silenciar": {
            "post": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "silenciarCanal",
                "summary": "Mute/unmute",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "silenciar": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "silenciar": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CanalDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/chat/mensagens/{id}": {
            "put": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "editarMensagem",
                "summary": "Edit own message",
                "description": "Within the configured window (15 min by default).",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "corpo"
                                ],
                                "properties": {
                                    "corpo": {
                                        "type": "string"
                                    }
                                }
                            },
                            "example": {
                                "corpo": "O paciente das 14 h já está na sala 2."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Mensagem"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "apagarMensagem",
                "summary": "Delete message",
                "description": "Own message or, as channel manager, someone else's. The text is erased; «Message deleted» and the audit entry remain.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/chat/mensagens/{id}/tarefa": {
            "post": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "criarTarefaDaMensagem",
                "summary": "Create task from message",
                "description": "The task gets origin «mensagem», linked to the channel patient/surgery; the channel receives a system message with the link.",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "titulo": {
                                        "type": "string"
                                    },
                                    "responsavel_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "prazo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time"
                                    },
                                    "prioridade": {
                                        "type": "string",
                                        "enum": [
                                            "baixa",
                                            "normal",
                                            "alta",
                                            "urgente"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "responsavel_id": 9,
                                "prioridade": "alta"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 88
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/chat/nao-lidas": {
            "get": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "contarNaoLidasDoChat",
                "summary": "Total unread messages",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "nao_lidas": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "nao_lidas": 5
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/chat/pessoas": {
            "get": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "procurarPessoasDoChat",
                "summary": "People to mention or invite",
                "description": "With «canal», only that channel members (mentions). External guests only see their channel.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Name.",
                        "example": "Inês"
                    },
                    {
                        "name": "canal",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Channel.",
                        "example": 7
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "nome": {
                                                        "type": "string"
                                                    },
                                                    "perfil": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "cor": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "foto_ficheiro_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/chat/privado": {
            "post": {
                "tags": [
                    "Chat interno"
                ],
                "operationId": "abrirConversaPrivada",
                "summary": "Open (or create) a direct conversation",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "utilizador_id"
                                ],
                                "properties": {
                                    "utilizador_id": {
                                        "type": "integer"
                                    }
                                }
                            },
                            "example": {
                                "utilizador_id": 9
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CanalDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/clinica/catalogo": {
            "get": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1CatalogoConsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "Consultation catalogue",
                "description": "In the request language: map zones (polygons in a 100 × 120 box, recipient and donor), scales with grades and loss per zone (Norwood, Ludwig, Savin, Sinclair and BASP), consultation types, areas, techniques, feasibility values, eligibility values, team roles, fields (with help and whether they are doctor-only) and screen sections. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1CatalogoConsulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/clinicas": {
            "get": {
                "tags": [
                    "Sessão"
                ],
                "operationId": "clinicas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Clinics available in the switcher",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "nome": {
                                                        "type": "string"
                                                    },
                                                    "atual": {
                                                        "type": "boolean"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "global": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/comercial/caixa": {
            "get": {
                "tags": [
                    "Caixa"
                ],
                "operationId": "m5CaixaObter",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "data",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Day (today by default)"
                    },
                    {
                        "name": "local_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Till location (with several locations; the main one by default)"
                    }
                ],
                "summary": "Till for a day",
                "description": "Till for the day (or null if not opened), expected totals per method, movements and recorded payments.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Caixa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Caixa"
                ],
                "operationId": "m5CaixaAbrir",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "Open today's till",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "saldo_inicial": {
                                        "type": "number",
                                        "x-unidade": "EUR"
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "local_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "saldo_inicial"
                                ]
                            },
                            "example": {
                                "saldo_inicial": 150
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5CaixaDia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/caixa/historico": {
            "get": {
                "tags": [
                    "Caixa"
                ],
                "operationId": "m5CaixaHistorico",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "limite",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 365
                        },
                        "description": "Number of days"
                    },
                    {
                        "name": "local_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Only this location\\x27s tills"
                    }
                ],
                "summary": "Till history",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M5CaixaResumo"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/caixa/{id}/fecho": {
            "post": {
                "tags": [
                    "Caixa"
                ],
                "operationId": "m5CaixaFechar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Close till",
                "description": "Count per method (every method with movements is mandatory). Stores counted amount and difference; difference ≠ 0 notifies administration. A closed till does not reopen.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "contagem": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "number",
                                            "x-unidade": "EUR"
                                        }
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "contagem"
                                ]
                            },
                            "example": {
                                "contagem": {
                                    "numerario": 412.5,
                                    "cartao": 1380
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5CaixaDia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/caixa/{id}/movimentos": {
            "post": {
                "tags": [
                    "Caixa"
                ],
                "operationId": "m5CaixaMovimento",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Cash-in or withdrawal",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "reforco",
                                            "levantamento"
                                        ]
                                    },
                                    "valor": {
                                        "type": "number",
                                        "x-unidade": "EUR"
                                    },
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 3
                                    }
                                },
                                "required": [
                                    "tipo",
                                    "valor",
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/caixa/{id}/pagamentos": {
            "post": {
                "tags": [
                    "Caixa"
                ],
                "operationId": "m5CaixaPagamento",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Record in-person payment",
                "description": "Receives a pending plan payment (pagamento_id) or creates an ad-hoc one (paciente_id, tipo, descricao, valor). In-person methods from Settings. Effects: payment paid in the till, tax document (automatic issue), commissions, pagamento.recebido event.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "pagamento_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "sinal",
                                            "intercalar",
                                            "restante",
                                            "consulta",
                                            "teleconsulta",
                                            "tratamento",
                                            "outro",
                                            "adiantamento",
                                            "pre_pagamento",
                                            "vale",
                                            "comparticipacao"
                                        ]
                                    },
                                    "descricao": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "valor": {
                                        "type": "number",
                                        "x-unidade": "EUR"
                                    },
                                    "metodo": {
                                        "type": "string",
                                        "enum": [
                                            "numerario",
                                            "cartao",
                                            "transferencia",
                                            "financiamento"
                                        ]
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "metodo"
                                ]
                            },
                            "example": {
                                "pagamento_id": 204,
                                "metodo": "cartao"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Pagamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/caixa/{id}/reconciliacao": {
            "get": {
                "tags": [
                    "Terminais de pagamento"
                ],
                "operationId": "m5Reconciliacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "summary": "Reconcile terminals with the till",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Reconciliacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/carteira": {
            "get": {
                "tags": [
                    "Carteira"
                ],
                "operationId": "m5Carteira",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "summary": "Patient wallet",
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient"
                    },
                    {
                        "name": "limite",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Entries (max 500)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Carteira"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/comercial/carteira/credito": {
            "post": {
                "tags": [
                    "Carteira"
                ],
                "operationId": "m5CarteiraCredito",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "summary": "Grant credit",
                "description": "Credit without money received: used in payments, never refunded. Reason required.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "valor": {
                                        "type": "number",
                                        "x-unidade": "EUR"
                                    },
                                    "motivo": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "paciente_id",
                                    "valor",
                                    "motivo"
                                ]
                            },
                            "example": {
                                "paciente_id": 12,
                                "valor": 50,
                                "motivo": "Compensação pela sessão remarcada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Carteira"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/carteira/devolucao": {
            "post": {
                "tags": [
                    "Carteira"
                ],
                "operationId": "m5CarteiraDevolucao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "Refund the patient",
                "description": "Up to the refundable balance. Cash leaves the location's open till. Issues credit notes on the advance invoices.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "valor": {
                                        "type": "number",
                                        "x-unidade": "EUR"
                                    },
                                    "metodo": {
                                        "type": "string",
                                        "enum": [
                                            "numerario",
                                            "transferencia",
                                            "cartao"
                                        ]
                                    },
                                    "motivo": {
                                        "type": "string"
                                    },
                                    "local_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "paciente_id",
                                    "valor",
                                    "metodo",
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Carteira"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/carteira/movimentos/{id}/estorno": {
            "post": {
                "tags": [
                    "Carteira"
                ],
                "operationId": "m5CarteiraEstorno",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "summary": "Reverse a credit",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Carteira"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/comercial/comissoes": {
            "get": {
                "tags": [
                    "Comissões e honorários"
                ],
                "operationId": "m5Comissoes",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "From"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Until"
                    },
                    {
                        "name": "tipo",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "todos",
                                "comissao",
                                "honorario"
                            ]
                        },
                        "description": "Type"
                    },
                    {
                        "name": "estado",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pendente",
                                "prevista",
                                "devida",
                                "paga",
                                "estornada",
                                "devido",
                                "pago"
                            ]
                        },
                        "description": "Status"
                    },
                    {
                        "name": "utilizador_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Person"
                    }
                ],
                "summary": "Commissions and fees",
                "description": "Indicators, lines, per-person summary and monthly paid series. Without financeiro.valores (edit), only own values.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Comissoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/comissoes/pagar": {
            "post": {
                "tags": [
                    "Comissões e honorários"
                ],
                "operationId": "m5ComissoesPagar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "summary": "Mark as paid",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "comissoes": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    },
                                    "honorarios": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    },
                                    "referencia": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "comissoes": [
                                    301,
                                    302
                                ],
                                "honorarios": [
                                    77
                                ],
                                "referencia": "TRF 2026-11-30"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "marcados": {
                                                    "type": "integer"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "marcados": 3,
                                        "mensagem": "3 valor(es) marcado(s) como pago(s)."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/contas/{id}": {
            "get": {
                "tags": [
                    "Contas pagadoras e convenções"
                ],
                "operationId": "m5ContaExtrato",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "summary": "Paying-account statement",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5ContaExtrato"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/comercial/documentos/{id}/eletronica": {
            "get": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5DocumentoEletronica",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "summary": "Document e-invoice",
                "description": "Status and what the connected invoicing software does through the integration (today none produces CIUS-PT nor signs the PDF).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "documento": {
                                                    "$ref": "#/components/schemas/M5Documento"
                                                },
                                                "capacidades": {
                                                    "type": "object",
                                                    "properties": {
                                                        "cius_pt": {
                                                            "type": "boolean"
                                                        },
                                                        "pdf_assinado": {
                                                            "type": "boolean"
                                                        },
                                                        "nota": {
                                                            "type": "string"
                                                        },
                                                        "fornecedor": {
                                                            "type": "string"
                                                        }
                                                    }
                                                },
                                                "formatos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "post": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5DocumentoEletronicaRegistar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "Record the delivered e-invoice",
                "description": "Delivery reference and/or the PDF with qualified signature (ficheiro_id from POST /ficheiros, PDF only).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "formato": {
                                        "type": "string",
                                        "enum": [
                                            "cius_pt",
                                            "pdf_assinado"
                                        ]
                                    },
                                    "referencia": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "ficheiro_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "formato"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Documento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/comercial/documentos/{id}/enviar": {
            "post": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5DocumentoEnviar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Email to the patient",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/documentos/{id}/nota-credito": {
            "post": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5DocumentoNotaCredito",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Issue credit note",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 3
                                    },
                                    "valor": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "x-unidade": "EUR"
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            },
                            "example": {
                                "motivo": "Reembolso parcial acordado",
                                "valor": 200
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Documento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/documentos/{id}/pdf": {
            "get": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5DocumentoPdf",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Tax document PDF",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "url": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Signed link to the document PDF."
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/locais": {
            "get": {
                "tags": [
                    "Caixa"
                ],
                "operationId": "m5Locais",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "summary": "Active clinic locations",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "nome": {
                                                        "type": "string"
                                                    },
                                                    "principal": {
                                                        "type": "boolean"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/comercial/pagamentos": {
            "get": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5PagamentosPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient"
                    },
                    {
                        "name": "episodio_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Episode"
                    }
                ],
                "summary": "Payment plan of the patient or episode",
                "description": "Payments, totals (accepted, paid, due, overdue), tax documents, available methods and allowed actions.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5PlanoPagamentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5PagamentosCriar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "Create payment",
                "description": "Pagamentos::criar — with an electronic method it immediately requests the clinic's provider (MB WAY requires a phone and honours the limit); with an in-person method and pago=true it requires the till open.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "proposta_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "sinal",
                                            "intercalar",
                                            "restante",
                                            "consulta",
                                            "teleconsulta",
                                            "tratamento",
                                            "outro",
                                            "adiantamento",
                                            "pre_pagamento",
                                            "vale",
                                            "comparticipacao"
                                        ]
                                    },
                                    "descricao": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "valor": {
                                        "type": "number",
                                        "x-unidade": "EUR"
                                    },
                                    "metodo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "mbway",
                                            "multibanco",
                                            "cartao",
                                            "numerario",
                                            "transferencia",
                                            "ligacao",
                                            "financiamento",
                                            "carteira",
                                            "vale",
                                            null
                                        ]
                                    },
                                    "telefone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "vence_em": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date"
                                    },
                                    "pago": {
                                        "type": "boolean"
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "local_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "tipo",
                                    "valor"
                                ]
                            },
                            "example": {
                                "paciente_id": 12,
                                "tipo": "consulta",
                                "descricao": "Consulta de avaliação",
                                "valor": 80,
                                "metodo": "mbway",
                                "telefone": "912345678"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Pagamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 204,
                                        "paciente_id": 12,
                                        "episodio_id": 31,
                                        "proposta_id": 57,
                                        "tipo": "sinal",
                                        "tipo_rotulo": "Sinal",
                                        "descricao": "Sinal — PR-2026-0057",
                                        "valor": 1380,
                                        "moeda": "EUR",
                                        "metodo": "mbway",
                                        "metodo_rotulo": "MB WAY",
                                        "estado": "pendente",
                                        "estado_rotulo": "Por pagar",
                                        "mb": null,
                                        "telefone_mascarado": "91*****78",
                                        "ligacao_url": null,
                                        "gateway": "ifthenpay",
                                        "confirmacao": null,
                                        "pedido_em": "2026-11-04T16:21:03+00:00",
                                        "pago_em": null,
                                        "vence_em": "2026-11-11",
                                        "vencido": false,
                                        "caixa_id": null,
                                        "recebido_por": null,
                                        "motivo": null,
                                        "notas": null,
                                        "documento": null,
                                        "acoes": {
                                            "gerar": true,
                                            "marcar_pago": true,
                                            "cancelar": true,
                                            "reembolsar": false,
                                            "faturar": false,
                                            "consultar": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/pagamentos/plano": {
            "post": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5PagamentosPlanoDaProposta",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "Create or adjust the plan of an accepted proposal",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "proposta_id": {
                                        "type": "integer"
                                    },
                                    "linhas": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "pagamento_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "valor": {
                                                    "type": "number",
                                                    "x-unidade": "EUR"
                                                },
                                                "vence_em": {
                                                    "type": "string",
                                                    "format": "date"
                                                }
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "proposta_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M5Pagamento"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/pagamentos/reparticao": {
            "get": {
                "tags": [
                    "Contas pagadoras e convenções"
                ],
                "operationId": "m5Reparticao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "summary": "Simulate the payer/patient split",
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient"
                    },
                    {
                        "name": "conta_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Paying account (or convencao_id)"
                    },
                    {
                        "name": "convencao_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Agreement"
                    },
                    {
                        "name": "procedimento_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Procedure (required for agreements)"
                    },
                    {
                        "name": "valor",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "number"
                        },
                        "description": "Procedure amount"
                    },
                    {
                        "name": "quantidade",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Quantity"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Reparticao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/comercial/pagamentos/repartidos": {
            "post": {
                "tags": [
                    "Contas pagadoras e convenções"
                ],
                "operationId": "m5Repartido",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "Create the payer and patient shares",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "conta_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "convencao_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "procedimento_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "valor": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "x-unidade": "EUR"
                                    },
                                    "quantidade": {
                                        "type": "integer"
                                    },
                                    "tipo": {
                                        "type": "string"
                                    },
                                    "descricao": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "metodo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "telefone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "pago": {
                                        "type": "boolean"
                                    },
                                    "vence_em": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date"
                                    },
                                    "autorizacao": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "local_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "paciente_id"
                                ]
                            },
                            "example": {
                                "paciente_id": 12,
                                "convencao_id": 3,
                                "procedimento_id": 9,
                                "tipo": "tratamento",
                                "metodo": "numerario",
                                "pago": true,
                                "autorizacao": "A-55120"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "grupo": {
                                                    "type": "string"
                                                },
                                                "reparticao": {
                                                    "$ref": "#/components/schemas/M5Reparticao"
                                                },
                                                "pagamentos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/M5Pagamento"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/pagamentos/saldos": {
            "get": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5PagamentosSaldos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "limite",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 200
                        },
                        "description": "Number of patients"
                    },
                    {
                        "name": "local_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Receipts from this location only"
                    }
                ],
                "summary": "Outstanding balances",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "kpis": {
                                                    "type": "object",
                                                    "properties": {
                                                        "por_cobrar": {
                                                            "type": "number",
                                                            "x-unidade": "EUR"
                                                        },
                                                        "vencido": {
                                                            "type": "number",
                                                            "x-unidade": "EUR"
                                                        },
                                                        "recebido_mes": {
                                                            "type": "number",
                                                            "x-unidade": "EUR"
                                                        },
                                                        "documentos_por_resolver": {
                                                            "type": "integer"
                                                        }
                                                    }
                                                },
                                                "saldos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "paciente_id": {
                                                                "type": "integer"
                                                            },
                                                            "nome": {
                                                                "type": "string"
                                                            },
                                                            "n": {
                                                                "type": "integer"
                                                            },
                                                            "pendente": {
                                                                "type": "number",
                                                                "x-unidade": "EUR"
                                                            },
                                                            "vencido": {
                                                                "type": "number",
                                                                "x-unidade": "EUR"
                                                            },
                                                            "proximo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date"
                                                            }
                                                        }
                                                    }
                                                },
                                                "recentes": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/M5Pagamento"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/pagamentos/{id}/cancelar": {
            "post": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5PagamentoCancelar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Cancel unpaid payment",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 3
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Pagamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/pagamentos/{id}/carteira": {
            "post": {
                "tags": [
                    "Carteira"
                ],
                "operationId": "m5PagarComSaldo",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "Pay with the wallet balance",
                "description": "Without amount = the maximum possible. If the balance is not enough, the payment is split (part with balance + remainder due). No new invoice.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "valor": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "x-unidade": "EUR"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "pagamento": {
                                                    "$ref": "#/components/schemas/M5Pagamento"
                                                },
                                                "carteira": {
                                                    "$ref": "#/components/schemas/M5Carteira"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/comercial/pagamentos/{id}/estado": {
            "get": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5PagamentoEstado",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Check status with the provider",
                "description": "For pending electronic payments asks the provider and applies the result (paid → «api» confirmation). Used by the live MB WAY status.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Pagamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 204,
                                        "paciente_id": 12,
                                        "episodio_id": 31,
                                        "proposta_id": 57,
                                        "tipo": "sinal",
                                        "tipo_rotulo": "Sinal",
                                        "descricao": "Sinal — PR-2026-0057",
                                        "valor": 1380,
                                        "moeda": "EUR",
                                        "metodo": "mbway",
                                        "metodo_rotulo": "MB WAY",
                                        "estado": "pendente",
                                        "estado_rotulo": "Por pagar",
                                        "mb": null,
                                        "telefone_mascarado": "91*****78",
                                        "ligacao_url": null,
                                        "gateway": "ifthenpay",
                                        "confirmacao": null,
                                        "pedido_em": "2026-11-04T16:21:03+00:00",
                                        "pago_em": null,
                                        "vence_em": "2026-11-11",
                                        "vencido": false,
                                        "caixa_id": null,
                                        "recebido_por": null,
                                        "motivo": null,
                                        "notas": null,
                                        "documento": null,
                                        "acoes": {
                                            "gerar": true,
                                            "marcar_pago": true,
                                            "cancelar": true,
                                            "reembolsar": false,
                                            "faturar": false,
                                            "consultar": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/pagamentos/{id}/fatura": {
            "post": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5PagamentoFaturar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Issue tax document",
                "description": "Faturacao::emitir (idempotent) through the clinic's certified software. Software error → document «erro» with the reason and automatic retry.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Documento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/pagamentos/{id}/gerar": {
            "post": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5PagamentoGerar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Generate MB WAY, reference or link",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "metodo": {
                                        "type": "string",
                                        "enum": [
                                            "mbway",
                                            "multibanco",
                                            "ligacao"
                                        ]
                                    },
                                    "telefone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "metodo"
                                ]
                            },
                            "example": {
                                "metodo": "multibanco"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Pagamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/pagamentos/{id}/marcar-pago": {
            "post": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5PagamentoMarcarPago",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Mark as paid",
                "description": "Cash and card require today's till open. Same effects as a confirmed payment.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "metodo": {
                                        "type": "string",
                                        "enum": [
                                            "mbway",
                                            "multibanco",
                                            "cartao",
                                            "numerario",
                                            "transferencia",
                                            "ligacao",
                                            "financiamento",
                                            "carteira",
                                            "vale"
                                        ]
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "local_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "metodo": "transferencia",
                                "notas": "Transferência confirmada no extrato"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Pagamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/pagamentos/{id}/reembolsar": {
            "post": {
                "tags": [
                    "Pagamentos"
                ],
                "operationId": "m5PagamentoReembolsar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Refund paid payment",
                "description": "Effects: credit note for the document (when it exists), reversal of the proposal's commissions, audit. The money is returned outside the platform.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 3
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Pagamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/pagamentos/{id}/terminal": {
            "post": {
                "tags": [
                    "Terminais de pagamento"
                ],
                "operationId": "m5CobrarNoTerminal",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "Send a pending payment to the terminal",
                "description": "Requires the location's till to be open (setting terminais.exigir_caixa). Returns the request; check its status at /comercial/terminais/pedidos/{id}.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "terminal_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "terminal_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5PedidoTerminal"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/pagamentos/{id}/vale": {
            "post": {
                "tags": [
                    "Vales de oferta"
                ],
                "operationId": "m5PagarComVale",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "Pay with a voucher",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "codigo": {
                                        "type": "string"
                                    },
                                    "valor": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "x-unidade": "EUR"
                                    }
                                },
                                "required": [
                                    "codigo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "pagamento": {
                                                    "$ref": "#/components/schemas/M5Pagamento"
                                                },
                                                "vale": {
                                                    "$ref": "#/components/schemas/M5Vale"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/precos/simular": {
            "get": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PrecosSimular",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "ver",
                "summary": "Simulate price",
                "description": "Precos::calcular without saving: base, extras, discount, VAT, total, total in the requested currency and average price per graft.",
                "parameters": [
                    {
                        "name": "procedimento_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Procedure"
                    },
                    {
                        "name": "tabela_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Price table"
                    },
                    {
                        "name": "enxertos",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Grafts"
                    },
                    {
                        "name": "sessoes",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Sessions"
                    },
                    {
                        "name": "quantidade",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "number"
                        },
                        "description": "Quantity"
                    },
                    {
                        "name": "desconto_pct",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "number"
                        },
                        "description": "Discount (%)"
                    },
                    {
                        "name": "desconto_valor",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "number"
                        },
                        "description": "Discount (EUR)"
                    },
                    {
                        "name": "moeda",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Currency"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Calculo"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "base": 6440,
                                        "extras": 0,
                                        "desconto": 0,
                                        "iva_valor": 0,
                                        "total": 6440,
                                        "moeda": "EUR",
                                        "total_moeda": 6440,
                                        "preco_medio_enxerto": 2.3
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas": {
            "get": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostasResumo",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "ver",
                "summary": "Proposals dashboard and list",
                "description": "Indicators (drafts, with the patient, open value, viewed, accepted this month, 90-day acceptance rate, stalled, discounts pending), filtered paginated list, monthly chart (sent and accepted series) and funnel. Honours scope (own/team/all).",
                "parameters": [
                    {
                        "name": "estado",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "rascunho",
                                "enviada",
                                "vista",
                                "aceite",
                                "recusada",
                                "expirada",
                                "em_aberto",
                                "parada",
                                "desconto_pendente"
                            ]
                        },
                        "description": "Status or special filter"
                    },
                    {
                        "name": "responsavel_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Owner"
                    },
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient"
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Number or title"
                    },
                    {
                        "name": "de",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Created from"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Created until"
                    },
                    {
                        "name": "pagina",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Page"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5ResumoPropostas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "kpis": {
                                            "rascunhos": 3,
                                            "em_aberto": 9,
                                            "valor_em_aberto": 61200,
                                            "vistas": 4,
                                            "aceites_mes": 5,
                                            "taxa_aceitacao_90d": 41.7,
                                            "paradas": 2,
                                            "descontos_pendentes": 1
                                        },
                                        "linhas": [
                                            {
                                                "id": 57,
                                                "numero": "PR-2026-0057",
                                                "titulo": "FUE · 2 800 enxertos",
                                                "estado": "vista",
                                                "estado_rotulo": "Vista",
                                                "total": 6900,
                                                "pessoa": "Ricardo Matos",
                                                "responsavel": "Sara Lopes",
                                                "parada": false,
                                                "validade_ate": "2026-11-27"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostasCriar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "summary": "Create proposal (from plan or manual)",
                "description": "With plano_id: Propostas::criarDoPlano — requires the approved plan; options from the plan scenarios or by intensity (Settings), with a plan snapshot and parameters version. Without plano_id: manual proposal with paciente_id or lead_id and procedimento_id. Effects: numbering, history, timeline, audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "plano_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "lead_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "procedimento_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "tabela_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "titulo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "enxertos": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "sessoes": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "quantidade": {
                                        "type": [
                                            "number",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "plano_id": 44
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Proposta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/planos": {
            "get": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostasPlanos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "summary": "Patient's approved plans",
                "description": "Summary of approved plans (version, technique, grafts, sessions, approval date) to create the proposal. Empty list without the planning module.",
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "versao": {
                                                        "type": "integer"
                                                    },
                                                    "tecnica": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "enxertos": {
                                                        "type": "integer"
                                                    },
                                                    "sessoes": {
                                                        "type": "integer"
                                                    },
                                                    "aprovado_em": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 44,
                                            "versao": 2,
                                            "tecnica": "FUE",
                                            "enxertos": 2800,
                                            "sessoes": 1,
                                            "aprovado_em": "2026-10-30T11:02:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}": {
            "get": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaObter",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Proposal detail",
                "description": "Everything the editor shows: options with calculation, lines, available extras, discount and profile limit, instalments (deposit and simulation), currency and rate, seal, public link (edit only), PDFs, history, allowed actions and, with financeiro.pagamentos, the payments. margem and custos_internos only with financeiro.valores (all).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Proposta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "put": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaGravar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Save and recalculate (draft)",
                "description": "Draft only. The server always recalculates (Precos::calcular). A discount above the profile limit becomes «pending» and notifies approvers. opcao_nova adds an option; opcao_remover removes the option with that key.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "titulo": {
                                        "type": "string"
                                    },
                                    "tabela_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "moeda": {
                                        "type": "string",
                                        "pattern": "^[A-Z]{3}$"
                                    },
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt",
                                            "en"
                                        ]
                                    },
                                    "validade_ate": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "opcoes": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "chave": {
                                                    "type": "string"
                                                },
                                                "titulo": {
                                                    "type": "string"
                                                },
                                                "titulo_en": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "enxertos": {
                                                    "type": "integer"
                                                },
                                                "sessoes": {
                                                    "type": "integer"
                                                },
                                                "quantidade": {
                                                    "type": "number"
                                                },
                                                "recomendada": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    },
                                    "extras": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "linhas": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "descricao",
                                                "valor"
                                            ],
                                            "properties": {
                                                "descricao": {
                                                    "type": "string"
                                                },
                                                "quantidade": {
                                                    "type": "number"
                                                },
                                                "valor": {
                                                    "type": "number",
                                                    "x-unidade": "EUR"
                                                },
                                                "iva_taxa": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    },
                                    "desconto_pct": {
                                        "type": "number"
                                    },
                                    "desconto_valor": {
                                        "type": "number",
                                        "x-unidade": "EUR"
                                    },
                                    "desconto_motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "prestacoes": {
                                        "type": "integer"
                                    },
                                    "opcao_nova": {
                                        "type": "boolean"
                                    },
                                    "opcao_remover": {
                                        "type": "string"
                                    },
                                    "condicoes": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "opcoes": [
                                    {
                                        "chave": "recomendada",
                                        "titulo": "Recomendada",
                                        "enxertos": 2800,
                                        "sessoes": 1,
                                        "quantidade": 1,
                                        "recomendada": true
                                    }
                                ],
                                "desconto_pct": 5,
                                "desconto_motivo": "Campanha de outono",
                                "prestacoes": 6
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Proposta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/aceitar": {
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaAceitarPresencial",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "In-person acceptance",
                "description": "Patient signature on the device (PNG data URL). Verifies the seal; stores the proof (accepted text, option, name, signature, IP, device, fingerprint); creates the payment plan and expected commissions; proposta.aceite event.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "opcao": {
                                        "type": "string"
                                    },
                                    "nome": {
                                        "type": "string",
                                        "minLength": 3,
                                        "maxLength": 160
                                    },
                                    "assinatura": {
                                        "type": "string",
                                        "pattern": "^data:image/png;base64,",
                                        "description": "PNG as data URL."
                                    },
                                    "prestacoes": {
                                        "type": "integer"
                                    },
                                    "aceitar": {
                                        "const": true
                                    }
                                },
                                "required": [
                                    "opcao",
                                    "nome",
                                    "assinatura",
                                    "aceitar"
                                ]
                            },
                            "example": {
                                "opcao": "recomendada",
                                "nome": "Ricardo Matos",
                                "assinatura": "data:image/png;base64,iVBORw0KGgo…",
                                "prestacoes": 1,
                                "aceitar": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Proposta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/anular": {
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaAnular",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Cancel acceptance",
                "description": "Accepted proposal: cancels unpaid payments, reverses commissions and returns to «recusada», with the reason. Paid payments are handled by refund.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 3,
                                        "maxLength": 500
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/codigo": {
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaCodigo",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "summary": "Apply a discount code",
                "description": "Draft only. The code's discount replaces the manual discount; above the code's approval threshold it becomes «pendente».",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "codigo": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "codigo"
                                ]
                            },
                            "example": {
                                "codigo": "PRIMAVERA10"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/codigo/retirar": {
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaCodigoRetirar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "summary": "Remove the discount code",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/desconto": {
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaPedirDesconto",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Apply or request discount",
                "description": "Within the profile limit it is applied; above it, it stays pending and notifies those with comercial.descontos (approve).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "desconto_pct": {
                                        "type": "number"
                                    },
                                    "desconto_valor": {
                                        "type": "number",
                                        "x-unidade": "EUR"
                                    },
                                    "desconto_motivo": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "desconto_motivo"
                                ]
                            },
                            "example": {
                                "desconto_pct": 12,
                                "desconto_motivo": "Segunda sessão no mesmo ano"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Proposta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/desconto/decisao": {
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaDecidirDesconto",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.descontos:aprovar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.descontos",
                "x-anagen-nivel": "aprovar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Approve or decline discount",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "aprovar",
                                            "recusar"
                                        ]
                                    },
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "aprovar"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Proposta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/enviar": {
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaEnviar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Send to patient",
                "description": "Requires a sealed proposal. Generates (or reuses) the personal link, generates the PDFs and sends through the requested channels with the Messenger. First sending → status «enviada», timeline and proposta.enviada event.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "canais": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "enum": [
                                                "email",
                                                "sms",
                                                "whatsapp"
                                            ]
                                        }
                                    }
                                }
                            },
                            "example": {
                                "canais": [
                                    "email",
                                    "whatsapp"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "envio_ok": {
                                                    "type": "boolean"
                                                },
                                                "ligacao": {
                                                    "type": "string"
                                                },
                                                "canais": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/pdf": {
            "get": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaPdf",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "idioma",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pt",
                                "en"
                            ]
                        },
                        "description": "PDF language"
                    }
                ],
                "summary": "Proposal PDF",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "url": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Signed link to the sealed PDF (15 minutes); null before sealing."
                                                },
                                                "publica": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "impressao": {
                                                    "type": "string",
                                                    "description": "Web print version (team session)."
                                                },
                                                "selada": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/reativar": {
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaReativar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Reactivate",
                "description": "A declined or expired proposal goes back to draft, with a new validity and recalculated with the current price table.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/recusar": {
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaRecusar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Record decline",
                "description": "Effects: status «recusada», history, timeline, proposta.recusada event.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 3,
                                        "maxLength": 500
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Proposta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/rever": {
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaRever",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "New version for revision",
                "description": "A sent or viewed proposal goes back to draft with version + 1 and no seal; the previous link stops accepting responses.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 3,
                                        "maxLength": 500
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/propostas/{id}/selar": {
            "post": {
                "tags": [
                    "Propostas"
                ],
                "operationId": "m5PropostaSelar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Seal",
                "description": "Recalculates, requires total > 0 and no pending discount, and stores the SHA-256 fingerprint of the canonical content (options, lines, values, terms, plan snapshot).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "impressao_digital": {
                                                    "type": "string"
                                                },
                                                "selada_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/terminais": {
            "get": {
                "tags": [
                    "Terminais de pagamento"
                ],
                "operationId": "m5Terminais",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "summary": "Terminals ready to charge",
                "parameters": [
                    {
                        "name": "local_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Location (terminals without a location serve all)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M5Terminal"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/comercial/terminais/cobrancas": {
            "post": {
                "tags": [
                    "Terminais de pagamento"
                ],
                "operationId": "m5CobrancaTerminal",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "New charge at the desk",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "valor": {
                                        "type": "number",
                                        "x-unidade": "EUR"
                                    },
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "sinal",
                                            "intercalar",
                                            "restante",
                                            "consulta",
                                            "teleconsulta",
                                            "tratamento",
                                            "outro",
                                            "adiantamento",
                                            "pre_pagamento",
                                            "vale",
                                            "comparticipacao"
                                        ]
                                    },
                                    "descricao": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "terminal_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "paciente_id",
                                    "valor",
                                    "terminal_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5PedidoTerminal"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/terminais/pedidos/{id}": {
            "get": {
                "tags": [
                    "Terminais de pagamento"
                ],
                "operationId": "m5PedidoTerminal",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "summary": "Live status of a charge",
                "description": "While «enviado», queries the provider (at most every 3 s).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5PedidoTerminal"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/comercial/terminais/pedidos/{id}/cancelar": {
            "post": {
                "tags": [
                    "Terminais de pagamento"
                ],
                "operationId": "m5CancelarPedidoTerminal",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "Cancel the charge on the terminal",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5PedidoTerminal"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/comercial/vales": {
            "post": {
                "tags": [
                    "Vales de oferta"
                ],
                "operationId": "m5ValeEmitir",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "summary": "Sell a voucher",
                "description": "Creates the voucher (unpaid) and the sale payment. The voucher becomes active when the payment is received. The full code is only returned to those who edit payments.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "valor": {
                                        "type": "number",
                                        "x-unidade": "EUR"
                                    },
                                    "validade": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "finalidade": {
                                        "type": "string",
                                        "enum": [
                                            "multipla",
                                            "unica"
                                        ]
                                    },
                                    "procedimento_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "comprador_paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "comprador_nome": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "beneficiario_nome": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "beneficiario_paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "mensagem": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "metodo": {
                                        "type": "string",
                                        "enum": [
                                            "numerario",
                                            "cartao",
                                            "transferencia",
                                            "financiamento",
                                            "mbway",
                                            "multibanco",
                                            "ligacao"
                                        ]
                                    },
                                    "pago": {
                                        "type": "boolean"
                                    },
                                    "telefone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "local_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "valor",
                                    "metodo"
                                ]
                            },
                            "example": {
                                "valor": 100,
                                "finalidade": "multipla",
                                "beneficiario_nome": "Ana",
                                "metodo": "numerario",
                                "pago": true
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "vale": {
                                                    "$ref": "#/components/schemas/M5Vale"
                                                },
                                                "pagamento": {
                                                    "$ref": "#/components/schemas/M5Pagamento"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comercial/vales/consulta": {
            "get": {
                "tags": [
                    "Vales de oferta"
                ],
                "operationId": "m5ValeConsultar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos"
                        ]
                    }
                ],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "summary": "Look up a voucher by code",
                "parameters": [
                    {
                        "name": "codigo",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Voucher code"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5Vale"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/comunicados": {
            "get": {
                "tags": [
                    "Comunicados"
                ],
                "operationId": "listarComunicados",
                "summary": "Notices addressed to the person",
                "description": "Published, in force and addressed to everyone, the department or the caller's role (managers see all). Create and edit: generic resource /r/comunicados.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "filtro",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "todos",
                                "por_ler",
                                "fixados"
                            ],
                            "default": "todos"
                        },
                        "description": "Filter."
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Title search."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Comunicado"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "por_ler": {
                                                    "type": "integer"
                                                },
                                                "gerir": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 3,
                                            "titulo": "Novo protocolo de esterilização",
                                            "corpo": "<p>A partir de segunda-feira…</p>",
                                            "resumo": "A partir de segunda-feira…",
                                            "publico": "departamento",
                                            "publico_rotulo": "Departamento",
                                            "destino": "enfermagem",
                                            "destino_rotulo": "Enfermagem",
                                            "importancia": "alta",
                                            "exige_leitura": true,
                                            "fixado": true,
                                            "publicado_em": "2026-10-27T08:00:00+00:00",
                                            "expira_em": null,
                                            "lido_em": null,
                                            "por_ler": true,
                                            "estatisticas": {
                                                "lidos": 6,
                                                "total": 9
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/comunicados/{id}": {
            "get": {
                "tags": [
                    "Comunicados"
                ],
                "operationId": "obterComunicado",
                "summary": "Read notice",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Comunicado"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 3,
                                        "titulo": "Novo protocolo de esterilização",
                                        "corpo": "<p>A partir de segunda-feira…</p>",
                                        "resumo": "A partir de segunda-feira…",
                                        "publico": "departamento",
                                        "publico_rotulo": "Departamento",
                                        "destino": "enfermagem",
                                        "destino_rotulo": "Enfermagem",
                                        "importancia": "alta",
                                        "exige_leitura": true,
                                        "fixado": true,
                                        "publicado_em": "2026-10-27T08:00:00+00:00",
                                        "expira_em": null,
                                        "lido_em": null,
                                        "por_ler": true,
                                        "estatisticas": {
                                            "lidos": 6,
                                            "total": 9
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/comunicados/{id}/leituras": {
            "get": {
                "tags": [
                    "Comunicados"
                ],
                "operationId": "leiturasDoComunicado",
                "summary": "Who read and who has not (managers)",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "lidos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "nome": {
                                                                "type": "string"
                                                            },
                                                            "lido_em": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            },
                                                            "origem": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                },
                                                "por_ler": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "nome": {
                                                                "type": "string"
                                                            },
                                                            "perfil": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/comunicados/{id}/lembrar": {
            "post": {
                "tags": [
                    "Comunicados"
                ],
                "operationId": "lembrarLeituraDoComunicado",
                "summary": "Remind those who have not read",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "pessoas": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "pessoas": 3
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/comunicados/{id}/ler": {
            "post": {
                "tags": [
                    "Comunicados"
                ],
                "operationId": "confirmarLeituraDoComunicado",
                "summary": "Confirm reading",
                "description": "Idempotent. Stores who, when and from where (web/app) and writes the audit log.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Comunicado"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/conformidade/assinatura-qualificada": {
            "get": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2AssinaturaQualificadaEstado",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "ver",
                "summary": "Mobile Digital Key service status",
                "description": "Tells whether Mobile Digital Key signing is available and, if not, what is missing (AMA agreement/credentials in Settings, server modules, PDF generator). Without credentials, requests are refused and nothing is sent.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "disponivel": {
                                                    "type": "boolean"
                                                },
                                                "em_falta": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "ambiente": {
                                                    "type": "string",
                                                    "enum": [
                                                        "preprod",
                                                        "producao"
                                                    ]
                                                },
                                                "ambiente_rotulo": {
                                                    "type": "string"
                                                },
                                                "validade_min": {
                                                    "type": "integer"
                                                },
                                                "mensagem": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "disponivel": false,
                                        "em_falta": [
                                            "inativa",
                                            "sem_aplicacao"
                                        ],
                                        "ambiente": "preprod",
                                        "ambiente_rotulo": "Ambiente de testes",
                                        "validade_min": 5,
                                        "mensagem": "A assinatura com a Chave Móvel Digital precisa do contrato com a AMA…"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/avisos": {
            "get": {
                "tags": [
                    "Proteção de dados"
                ],
                "operationId": "m2AvisosResumo",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "dias",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 365
                        },
                        "description": "Display period (30 by default)."
                    }
                ],
                "summary": "Notices in force per channel and displays",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "canal": {
                                                        "type": "string"
                                                    },
                                                    "canal_rotulo": {
                                                        "type": "string"
                                                    },
                                                    "em_vigor": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "idioma": {
                                                                    "type": "string"
                                                                },
                                                                "versao": {
                                                                    "type": "integer"
                                                                },
                                                                "publicado_em": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ],
                                                                    "format": "date-time"
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "exibicoes": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/consentimentos/{id}/prova": {
            "get": {
                "tags": [
                    "Consentimentos"
                ],
                "operationId": "m2ConsentimentoProva",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "ver",
                "summary": "Proof of a consent",
                "description": "Exact text of the accepted version, integrity check (texto_integro), decision, channel, dates, who collected, device, IP, fingerprints, delivery and temporary links (15 min) to the signature images. The request is logged as an export.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consent identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Prova"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos": {
            "post": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosEmitir",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Issue a document",
                "description": "Assigns a number, a verification code and a fingerprint; content is encrypted; the PDF is generated when the generator is installed. Missing mandatory extra fields → 422 (campos.{key}).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "modelo_id": {
                                        "type": "integer"
                                    },
                                    "paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "cirurgia_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "medico_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "campos": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "string"
                                        }
                                    },
                                    "partilhar": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "modelo_id"
                                ]
                            },
                            "example": {
                                "modelo_id": 3,
                                "paciente_id": 1204,
                                "episodio_id": 77,
                                "partilhar": true
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Documento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 902,
                                        "numero": "DOC-2026-0142",
                                        "titulo": "Instruções pós-operatórias",
                                        "tipo": "instrucoes",
                                        "tipo_rotulo": "Instruções",
                                        "clinico": false,
                                        "paciente_id": 1204,
                                        "episodio_id": 77,
                                        "modelo_id": 3,
                                        "modelo_versao": 1,
                                        "estado": "enviado",
                                        "estado_rotulo": "Enviado para assinatura",
                                        "codigo_verificacao": "K7QM-3XRA",
                                        "url_verificacao": "https://clinica.example/verificar/K7QM-3XRA",
                                        "conteudo_hash": "9f2c…e01a",
                                        "assinatura_tipo": null,
                                        "assinatura_canal": "email",
                                        "assinatura_destino": "r***@example.com",
                                        "assinatura_expira": "2026-10-30T10:00:00+00:00",
                                        "assinado_em": null,
                                        "assinado_nome": null,
                                        "libertado_em": null,
                                        "partilhado_paciente": true,
                                        "enviado_em": "2026-10-28T10:00:00+00:00",
                                        "anulado_em": null,
                                        "anulado_motivo": null,
                                        "tem_pdf": true,
                                        "certificado": null,
                                        "pode_ver_conteudo": true,
                                        "criado_em": "2026-10-28T09:58:00+00:00",
                                        "conteudo": "<p>…</p>",
                                        "em_falta": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/modelos": {
            "get": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosModelos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "ver",
                "summary": "Approved templates and available fields",
                "description": "Approved templates with the extra fields requested when issuing; meta.campos_disponiveis lists the automatic fields ({{group.field}} → label).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M2ModeloDocumento"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "campos_disponiveis": {
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/pre-visualizar": {
            "post": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosPreVisualizar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "summary": "Preview a document",
                "description": "Sanitised HTML with the fields replaced and the list of fields without data. Stores nothing. Clinical templates require clinical access to the patient.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "modelo_id": {
                                        "type": "integer"
                                    },
                                    "paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "cirurgia_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "medico_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "campos": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "required": [
                                    "modelo_id"
                                ]
                            },
                            "example": {
                                "modelo_id": 3,
                                "paciente_id": 1204,
                                "campos": {
                                    "observacoes": "Evitar exposição solar 15 dias."
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "html": {
                                                    "type": "string"
                                                },
                                                "em_falta": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "html": "<h2>Instruções pós-operatórias</h2><p>…</p>",
                                        "em_falta": [
                                            "cirurgia.data"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/{id}": {
            "get": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosObter",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "ver",
                "summary": "Document with certificate and timeline",
                "description": "Content is only included when pode_ver_conteudo (clinical documents: clinical access to the patient).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Documento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 902,
                                        "numero": "DOC-2026-0142",
                                        "titulo": "Instruções pós-operatórias",
                                        "tipo": "instrucoes",
                                        "tipo_rotulo": "Instruções",
                                        "clinico": false,
                                        "paciente_id": 1204,
                                        "episodio_id": 77,
                                        "modelo_id": 3,
                                        "modelo_versao": 1,
                                        "estado": "enviado",
                                        "estado_rotulo": "Enviado para assinatura",
                                        "codigo_verificacao": "K7QM-3XRA",
                                        "url_verificacao": "https://clinica.example/verificar/K7QM-3XRA",
                                        "conteudo_hash": "9f2c…e01a",
                                        "assinatura_tipo": null,
                                        "assinatura_canal": "email",
                                        "assinatura_destino": "r***@example.com",
                                        "assinatura_expira": "2026-10-30T10:00:00+00:00",
                                        "assinado_em": null,
                                        "assinado_nome": null,
                                        "libertado_em": null,
                                        "partilhado_paciente": true,
                                        "enviado_em": "2026-10-28T10:00:00+00:00",
                                        "anulado_em": null,
                                        "anulado_motivo": null,
                                        "tem_pdf": true,
                                        "certificado": null,
                                        "pode_ver_conteudo": true,
                                        "criado_em": "2026-10-28T09:58:00+00:00",
                                        "paciente": {
                                            "id": 1204,
                                            "nome": "Rui Almeida",
                                            "numero": "P-2026-0311",
                                            "tem_email": true,
                                            "tem_telefone": true
                                        },
                                        "assinatura_medico": false,
                                        "eventos": [],
                                        "pode_editar": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/{id}/anular": {
            "post": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosAnular",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    }
                ],
                "summary": "Cancel",
                "description": "The document stays in the archive; public verification shows it as cancelled.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 3,
                                        "maxLength": 500
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            },
                            "example": {
                                "motivo": "Emitido com o episódio errado."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "estado": {
                                                    "const": "anulado"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "estado": "anulado",
                                        "mensagem": "Documento anulado."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/{id}/assinar": {
            "post": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosAssinar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    }
                ],
                "summary": "Sign on screen (in person)",
                "description": "Holder signature (and physician signature when the template asks). Generates the certificate.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "assinatura": {
                                        "type": "string",
                                        "contentEncoding": "base64",
                                        "maxLength": 2800000,
                                        "description": "PNG signature image, base64 or «data:image/png;base64,…» (max 2 MB)."
                                    },
                                    "nome": {
                                        "type": "string",
                                        "minLength": 3,
                                        "maxLength": 160
                                    },
                                    "assinatura_medico": {
                                        "type": "string",
                                        "contentEncoding": "base64",
                                        "maxLength": 2800000,
                                        "description": "PNG signature image, base64 or «data:image/png;base64,…» (max 2 MB)."
                                    }
                                },
                                "required": [
                                    "assinatura",
                                    "nome"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Documento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/{id}/cmd": {
            "get": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosCmdPedidos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    }
                ],
                "summary": "Qualified signature requests of the document",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M2PedidoCmd"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "servico": {
                                                    "type": "object"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosCmdIniciar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    }
                ],
                "summary": "Request the Mobile Digital Key signature",
                "description": "The holder gives the mobile number and PIN. The platform obtains the certificate chain, prepares the PDF for PAdES, computes the signed-attributes digest and requests the signature from the AMA service, which texts a code to the holder. The PIN is never stored or returned. Reflection period applies. Limit: 10 per 10 minutes.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "telemovel": {
                                        "type": "string",
                                        "maxLength": 20
                                    },
                                    "pin": {
                                        "type": "string",
                                        "pattern": "^[0-9]{4,8}$",
                                        "writeOnly": true
                                    }
                                },
                                "required": [
                                    "telemovel",
                                    "pin"
                                ]
                            },
                            "example": {
                                "telemovel": "+351 912345678",
                                "pin": "••••"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2PedidoCmd"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/{id}/cmd/{pedido}/cancelar": {
            "post": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosCmdCancelar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    },
                    {
                        "name": "pedido",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Signature request"
                    }
                ],
                "summary": "Cancel the request",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "estado": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 12,
                                        "estado": "cancelado"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/{id}/cmd/{pedido}/codigo": {
            "post": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosCmdCodigo",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    },
                    {
                        "name": "pedido",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Signature request"
                    }
                ],
                "summary": "Confirm the code and complete",
                "description": "Validates the code with the service, checks the signature against the certificate, writes the CMS container into the PDF (PAdES, ETSI.CAdES.detached), validates the result and stores it as the document signature, with the completion certificate and linked consent. Up to 3 attempts per request.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "codigo": {
                                        "type": "string",
                                        "pattern": "^[0-9]{4,8}$"
                                    }
                                },
                                "required": [
                                    "codigo"
                                ]
                            },
                            "example": {
                                "codigo": "123456"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Documento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/{id}/cmd/{pedido}/sms": {
            "post": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosCmdSms",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    },
                    {
                        "name": "pedido",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Signature request"
                    }
                ],
                "summary": "Resend the code by text message",
                "description": "The mobile number must match the request (compared by blind index). Limit: 5 per 10 minutes.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "telemovel": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "telemovel"
                                ]
                            },
                            "example": {
                                "telemovel": "+351 912345678"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2PedidoCmd"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/{id}/enviar": {
            "post": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosEnviar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Send for signature with a code",
                "description": "Creates a new link (the previous one stops working) and a 6-digit code sent in a separate message. Validity and attempts in Settings.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "email",
                                            "sms",
                                            "whatsapp"
                                        ]
                                    }
                                },
                                "required": [
                                    "canal"
                                ]
                            },
                            "example": {
                                "canal": "email"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "destino": {
                                                    "type": "string"
                                                },
                                                "canal_codigo": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "expira_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "mensagem": "Enviado para r***@example.com. O código seguiu numa mensagem separada.",
                                        "destino": "r***@example.com",
                                        "canal_codigo": "sms",
                                        "expira_em": "2026-10-30T10:00:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Action refused (acao_recusada)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M2RespostaErro"
                                },
                                "examples": {
                                    "envio_falhou": {
                                        "summary": "envio_falhou",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "acao_recusada",
                                                "mensagem": "Não foi possível enviar: endereço inválido."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/{id}/partilhar": {
            "post": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosPartilhar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    }
                ],
                "summary": "Share in or remove from the portal",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "partilhar": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "partilhar"
                                ]
                            },
                            "example": {
                                "partilhar": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "partilhado_paciente": {
                                                    "type": "boolean"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "partilhado_paciente": true,
                                        "mensagem": "Documento partilhado no portal."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/{id}/pdf": {
            "get": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosPdf",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "ver",
                "summary": "Document PDF",
                "description": "With a stored PDF: {tipo: \"pdf\", url (15 min)}. Without: {tipo: \"html\", html, url_web} to display or print.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "tipo": {
                                                    "type": "string",
                                                    "enum": [
                                                        "pdf",
                                                        "html"
                                                    ]
                                                },
                                                "url": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "expira_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "html": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "url_web": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "tipo": "pdf",
                                        "url": "https://clinica.example/ficheiros/…",
                                        "expira_em": "2026-10-28T10:15:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/documentos/{id}/qualificada": {
            "post": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2DocumentosQualificada",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document identifier"
                    }
                ],
                "summary": "Attach a PDF with a qualified signature",
                "description": "ficheiro_id of a PDF already uploaded with POST /ficheiros. The file must contain a digital signature, which is validated: structure, content integrity (digest of the covered ranges), mathematical signature against the included certificate, certificate validity at the declared time, qualified-certificate statement and consistency of the included chain. A PDF changed after signing or with a signature that does not match is refused (422). The result is stored in certificado.validacao, with the list of what is not validated here (root trust, revocation, timestamps).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "ficheiro_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "ficheiro_id"
                                ]
                            },
                            "example": {
                                "ficheiro_id": 7781
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Documento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/dpo": {
            "get": {
                "tags": [
                    "Proteção de dados"
                ],
                "operationId": "m2Dpo",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "ver",
                "summary": "Data protection officer dashboard",
                "description": "The same data as the web screen: kpis (with web and app links), requests, complaints, incidents (seconds until the CNPD deadline), alerts (empty without admin.auditoria), processors, rat, training, ers, review (null without admin.utilizadores), consents (chart per purpose and decision, per day, withdrawals in 30 days), equipment, templates to approve, retention and officer; permissoes tells which actions are available. No clinical data.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Painel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/dpo/alertas/detetar": {
            "post": {
                "tags": [
                    "Proteção de dados"
                ],
                "operationId": "m2AlertasDetetar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "editar",
                "summary": "Detect anomalous access now",
                "description": "Analyses the last 24 h of the activity log. criados: number of new alerts per type.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "criados": {
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "criados": {
                                            "volume": 1,
                                            "fora_horas": 0
                                        },
                                        "total": 1,
                                        "mensagem": "Deteção concluída: 1 alertas novos."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/dpo/alertas/{id}/rever": {
            "post": {
                "tags": [
                    "Proteção de dados"
                ],
                "operationId": "m2AlertasRever",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "editar",
                "summary": "Review an alert",
                "description": "«injustificado» creates a task for administration. An alert about one’s own access cannot be reviewed by that person.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Alert identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "justificado",
                                            "injustificado",
                                            "falso_positivo"
                                        ]
                                    },
                                    "notas": {
                                        "type": "string",
                                        "maxLength": 2000
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "justificado",
                                "notas": "Consulta de rotina do dia."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "mensagem": "Alerta revisto."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/dpo/ers/{id}": {
            "post": {
                "tags": [
                    "Proteção de dados"
                ],
                "operationId": "m2ErsConfirmar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "summary": "Confirm the ERS register update",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Professional (user) identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "mensagem": "Registo na ERS confirmado."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/dpo/revisao": {
            "post": {
                "tags": [
                    "Proteção de dados"
                ],
                "operationId": "m2RevisaoIniciar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "summary": "Start the access review",
                "description": "Stores the snapshot of effective permissions (or returns the review in progress).",
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 12
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/dpo/revisao/{id}": {
            "get": {
                "tags": [
                    "Proteção de dados"
                ],
                "operationId": "m2RevisaoObter",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "ver",
                "summary": "Review with the snapshot",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Review identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Revisao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/dpo/revisao/{id}/concluir": {
            "post": {
                "tags": [
                    "Proteção de dados"
                ],
                "operationId": "m2RevisaoConcluir",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "summary": "Complete the review",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Review identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "notas": {
                                        "type": "string",
                                        "minLength": 3,
                                        "maxLength": 5000
                                    },
                                    "alteracoes": {
                                        "type": "string",
                                        "maxLength": 5000
                                    }
                                },
                                "required": [
                                    "notas"
                                ]
                            },
                            "example": {
                                "notas": "Acessos conferidos com a direção.",
                                "alteracoes": "Desativada a conta de um técnico sem uso."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "mensagem": "Revisão concluída."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/pacientes/{id}/acessos": {
            "get": {
                "tags": [
                    "Proteção de dados"
                ],
                "operationId": "m2QuemAcedeu",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "ver",
                "summary": "Who accessed the patient data",
                "description": "Permission: admin.auditoria (view) or conformidade (edit). Up to the 1000 most recent records, filtered; summary, per day, people and per action. The request is logged.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    },
                    {
                        "name": "f[acao]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "ver",
                                "criar",
                                "alterar",
                                "apagar",
                                "exportar",
                                "imprimir",
                                "entrar",
                                "sair",
                                "falha_entrada",
                                "acesso_emergencia",
                                "aprovar",
                                "enviar",
                                "assinar",
                                "revogar",
                                "descarregar"
                            ]
                        },
                        "description": "Action."
                    },
                    {
                        "name": "f[ator]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Person name."
                    },
                    {
                        "name": "f[perfil]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Profile key."
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "web",
                                "api",
                                "gancho",
                                "agendador"
                            ]
                        },
                        "description": "Origin."
                    },
                    {
                        "name": "f[de]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "From."
                    },
                    {
                        "name": "f[ate]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Until."
                    },
                    {
                        "name": "f[emergencia]",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        },
                        "description": "Emergency access only."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Acessos"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "filtros": {
                                                    "type": "object"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/pacientes/{id}/avisos": {
            "get": {
                "tags": [
                    "Consentimentos"
                ],
                "operationId": "m2PacienteAvisos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    }
                ],
                "summary": "Privacy notices shown to the patient",
                "description": "Versions shown per channel (including those shown while a sales contact), with text and row integrity checks.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M2AvisoMostrado"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/pacientes/{id}/consentimentos": {
            "get": {
                "tags": [
                    "Consentimentos"
                ],
                "operationId": "m2PacienteConsentimentos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "ver",
                "summary": "Current state per purpose",
                "description": "Latest decision of each purpose for the patient.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "finalidade": {
                                                        "type": "string",
                                                        "enum": [
                                                            "tratamento_clinico",
                                                            "fotografias_clinicas",
                                                            "imagens_comunicacao",
                                                            "captura_3d",
                                                            "gravacao_chamadas",
                                                            "gravacao_video",
                                                            "ia",
                                                            "agente_voz",
                                                            "marketing",
                                                            "partilha_terceiros",
                                                            "teleconsulta",
                                                            "cirurgico",
                                                            "contacto"
                                                        ]
                                                    },
                                                    "finalidade_rotulo": {
                                                        "type": "string"
                                                    },
                                                    "consentimento_id": {
                                                        "type": "integer"
                                                    },
                                                    "decisao": {
                                                        "type": "string",
                                                        "enum": [
                                                            "dado",
                                                            "recusado",
                                                            "revogado"
                                                        ]
                                                    },
                                                    "decisao_rotulo": {
                                                        "type": "string"
                                                    },
                                                    "canal": {
                                                        "type": "string"
                                                    },
                                                    "modelo_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "versao": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "em": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "finalidade": "fotografias_clinicas",
                                            "finalidade_rotulo": "Fotografias clínicas",
                                            "consentimento_id": 5480,
                                            "decisao": "dado",
                                            "decisao_rotulo": "Dado",
                                            "canal": "presencial",
                                            "modelo_id": 2,
                                            "versao": 1,
                                            "em": "2026-10-10T11:00:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/reclamacoes/exportar-ers": {
            "get": {
                "tags": [
                    "Proteção de dados"
                ],
                "operationId": "m2ReclamacoesErs",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "exportar",
                "summary": "Export complaints for the ERS (CSV)",
                "description": "Requires export permission. CSV with «;», UTF-8 with BOM: number, Book reference, type, channel, category, dates, status and working days to reply. Marks the rows as exported.",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Start (inclusive)."
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "End (inclusive)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "CSV file",
                        "content": {
                            "text/csv": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/recolha": {
            "get": {
                "tags": [
                    "Consentimentos"
                ],
                "operationId": "m2RecolhaDados",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "ver",
                "summary": "Collection data for a patient",
                "description": "Patient, chosen episode and the patient episodes, privacy notice in force (channel «app», falling back to «portal») with the date it was shown, approved applicable templates in the patient language with the current state of each purpose, the delivery in progress (with seconds until the end of the reflection period) and, for surgical ones with an episode, validity and reasons; physicians who can sign. No side effects.",
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient."
                    },
                    {
                        "name": "episodio_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Episode (for the surgical consent)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Recolha"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "paciente": {
                                            "id": 1204,
                                            "numero": "P-2026-0311",
                                            "nome": "Rui Almeida",
                                            "idioma": "pt-PT",
                                            "tem_email": true,
                                            "tem_telefone": true,
                                            "portal_ativo": true
                                        },
                                        "episodio": {
                                            "id": 77,
                                            "numero": "E-2026-0077",
                                            "titulo": "Transplante capilar",
                                            "tecnica": "FUE"
                                        },
                                        "episodios": [
                                            {
                                                "id": 77,
                                                "numero": "E-2026-0077",
                                                "titulo": "Transplante capilar",
                                                "tecnica": "FUE",
                                                "estado": "planeamento"
                                            }
                                        ],
                                        "aviso": {
                                            "id": 6,
                                            "canal": "app",
                                            "versao": 1,
                                            "titulo": "Aviso de privacidade",
                                            "texto": "<p>…</p>",
                                            "visto_em": null
                                        },
                                        "modelos": [
                                            {
                                                "id": 14,
                                                "chave": "cirurgico_fue",
                                                "titulo": "Consentimento informado — FUE",
                                                "finalidade": "cirurgico",
                                                "finalidade_rotulo": "Consentimento cirúrgico",
                                                "base_legal": "consentimento",
                                                "base_legal_rotulo": "Consentimento",
                                                "informativo": false,
                                                "obrigatorio": true,
                                                "escrito": true,
                                                "versao": 2,
                                                "tecnica": "FUE",
                                                "idioma": "pt-PT",
                                                "texto": "<h3>Descrição do ato</h3><p>…</p>",
                                                "reflexao_horas": 48,
                                                "estado_atual": null,
                                                "entrega": {
                                                    "id": 311,
                                                    "modelo_id": 14,
                                                    "modelo_versao": 2,
                                                    "entregue_em": "2026-10-28T10:05:00+00:00",
                                                    "liberta_em": "2026-10-29T10:05:00+00:00",
                                                    "segundos_restantes": 86400,
                                                    "estado": "entregue",
                                                    "documento_id": 902,
                                                    "canal": "app"
                                                },
                                                "cirurgico": {
                                                    "valido": false,
                                                    "motivos": [
                                                        {
                                                            "codigo": "reflexao",
                                                            "texto": "Período de reflexão não cumprido"
                                                        }
                                                    ],
                                                    "plano": {
                                                        "id": 40,
                                                        "versao": 3,
                                                        "aprovado_em": "2026-10-20T16:00:00+00:00"
                                                    }
                                                }
                                            }
                                        ],
                                        "medicos": [
                                            {
                                                "id": 7,
                                                "nome": "Inês Valente",
                                                "cedula": "54321"
                                            }
                                        ],
                                        "agora": "2026-10-28T10:06:00+00:00",
                                        "pode_editar": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/recolha/aviso": {
            "post": {
                "tags": [
                    "Consentimentos"
                ],
                "operationId": "m2RecolhaAviso",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Record that the privacy notice was shown",
                "description": "Stores which notice version was shown to the patient and when.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "aviso_id": {
                                        "type": "integer"
                                    },
                                    "canal": {
                                        "type": "string",
                                        "default": "app"
                                    }
                                },
                                "required": [
                                    "paciente_id",
                                    "aviso_id"
                                ]
                            },
                            "example": {
                                "paciente_id": 1204,
                                "aviso_id": 6
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 3120,
                                        "mensagem": "Ficou registado que o aviso de privacidade foi mostrado."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/recolha/entregar": {
            "post": {
                "tags": [
                    "Consentimentos"
                ],
                "operationId": "m2RecolhaEntregar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Deliver the information of a template",
                "description": "Records the delivery of the information (full text and version) and starts the template reflection period. By default the information is also stored as a document in the patient portal (copia_portal).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "modelo_id": {
                                        "type": "integer"
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "plano_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "copia_portal": {
                                        "type": "boolean",
                                        "default": true
                                    }
                                },
                                "required": [
                                    "paciente_id",
                                    "modelo_id"
                                ]
                            },
                            "example": {
                                "paciente_id": 1204,
                                "modelo_id": 14,
                                "episodio_id": 77
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Entrega"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 311,
                                        "modelo_id": 14,
                                        "modelo_versao": 2,
                                        "entregue_em": "2026-10-28T10:05:00+00:00",
                                        "liberta_em": "2026-10-29T10:05:00+00:00",
                                        "segundos_restantes": 86400,
                                        "estado": "entregue",
                                        "documento_id": 902,
                                        "canal": "app"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/recolha/enviar": {
            "post": {
                "tags": [
                    "Consentimentos"
                ],
                "operationId": "m2RecolhaEnviar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Send for signature at home",
                "description": "Delivers the information, creates the document and sends the patient the personal link (email, SMS or WhatsApp) with the one-time code in a separate message. The reflection period applies to the link.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "modelo_id": {
                                        "type": "integer"
                                    },
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "email",
                                            "sms",
                                            "whatsapp"
                                        ]
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "paciente_id",
                                    "modelo_id",
                                    "canal"
                                ]
                            },
                            "example": {
                                "paciente_id": 1204,
                                "modelo_id": 14,
                                "canal": "email",
                                "episodio_id": 77
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "destino": {
                                                    "type": "string"
                                                },
                                                "canal_codigo": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "expira_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "documento_id": {
                                                    "type": "integer"
                                                },
                                                "entrega": {
                                                    "$ref": "#/components/schemas/M2Entrega"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "mensagem": "Enviado para r***@example.com. O código seguiu numa mensagem separada.",
                                        "destino": "r***@example.com",
                                        "canal_codigo": "sms",
                                        "expira_em": "2026-10-30T10:00:00+00:00",
                                        "documento_id": 903,
                                        "entrega": {
                                            "id": 311,
                                            "modelo_id": 14,
                                            "modelo_versao": 2,
                                            "entregue_em": "2026-10-28T10:05:00+00:00",
                                            "liberta_em": "2026-10-29T10:05:00+00:00",
                                            "segundos_restantes": 86400,
                                            "estado": "entregue",
                                            "documento_id": 902,
                                            "canal": "app"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Action refused (acao_recusada)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M2RespostaErro"
                                },
                                "examples": {
                                    "envio_falhou": {
                                        "summary": "envio_falhou",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "acao_recusada",
                                                "mensagem": "Não foi possível enviar: sem email."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/recolha/registar": {
            "post": {
                "tags": [
                    "Consentimentos"
                ],
                "operationId": "m2RecolhaRegistar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Record decisions and signatures",
                "description": "Each template must carry an explicit decision («dado» or «recusado»). Given written consents require the patient signature; the surgical one requires an episode, a recorded delivery, the end of the reflection period and the physician signature (medico_id + assinatura_medico). contra_assinar adds the physician signature to surgical consents signed at home. Field validation errors: decisoes.N, modelo_{id}, assinatura_paciente, assinatura_medico, episodio_id, medico_id.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "quiosque": {
                                        "type": "boolean"
                                    },
                                    "medico_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "assinatura_paciente": {
                                        "type": "string",
                                        "contentEncoding": "base64",
                                        "maxLength": 2800000,
                                        "description": "PNG signature image, base64 or «data:image/png;base64,…» (max 2 MB)."
                                    },
                                    "assinatura_medico": {
                                        "type": "string",
                                        "contentEncoding": "base64",
                                        "maxLength": 2800000,
                                        "description": "PNG signature image, base64 or «data:image/png;base64,…» (max 2 MB)."
                                    },
                                    "decisoes": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "modelo_id",
                                                "decisao"
                                            ],
                                            "properties": {
                                                "modelo_id": {
                                                    "type": "integer"
                                                },
                                                "decisao": {
                                                    "type": "string",
                                                    "enum": [
                                                        "dado",
                                                        "recusado"
                                                    ]
                                                },
                                                "motivo": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    },
                                    "contra_assinar": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    }
                                },
                                "required": [
                                    "paciente_id"
                                ]
                            },
                            "example": {
                                "paciente_id": 1204,
                                "episodio_id": 77,
                                "medico_id": 7,
                                "assinatura_paciente": "data:image/png;base64,iVBORw0…",
                                "assinatura_medico": "data:image/png;base64,iVBORw0…",
                                "decisoes": [
                                    {
                                        "modelo_id": 14,
                                        "decisao": "dado"
                                    },
                                    {
                                        "modelo_id": 9,
                                        "decisao": "recusado",
                                        "motivo": "Prefere não receber comunicações"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "registados": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "registados": [
                                            5501,
                                            5502
                                        ],
                                        "mensagem": "2 decisões registadas."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/titulares/{id}/exportacao": {
            "get": {
                "tags": [
                    "Proteção de dados"
                ],
                "operationId": "m2TitularExportacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "summary": "Export a data subject’s data (ZIP)",
                "description": "For access and portability requests: dados.json, summary (PDF or HTML), shareable documents and images. Clinical records are only included for callers with clinical access to the patient. Without the ZIP extension on the server, returns dados.json.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Data-subject request identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Archive",
                        "content": {
                            "application/zip": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            },
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/conformidade/verificar/{codigo}": {
            "get": {
                "tags": [
                    "Documentos"
                ],
                "operationId": "m2Verificar",
                "security": [],
                "summary": "Public document verification",
                "description": "No authentication and no clinical data: status, number, type, dates, entity, physician, holder initials and fingerprints of the content and the PDF. Rate-limited per address.",
                "parameters": [
                    {
                        "name": "codigo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9]{4}-?[A-Za-z0-9]{4}$"
                        },
                        "example": "K7QM-3XRA"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2Verificacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "valido": true,
                                        "estado": "assinado",
                                        "estado_rotulo": "Assinado",
                                        "numero": "DOC-2026-0142",
                                        "tipo": "instrucoes",
                                        "tipo_rotulo": "Instruções",
                                        "titulo": "Instruções pós-operatórias",
                                        "codigo_verificacao": "K7QM-3XRA",
                                        "emitido_em": "2026-10-28T09:58:00+00:00",
                                        "assinado_em": "2026-10-28T18:20:00+00:00",
                                        "assinatura_tipo": "codigo",
                                        "anulado_em": null,
                                        "conteudo_hash": "9f2c…e01a",
                                        "ficheiro_sha256": "41ab…77c0",
                                        "titular_iniciais": "R. A.",
                                        "medico": {
                                            "nome": "Inês Valente",
                                            "cedula": "54321"
                                        },
                                        "entidade": {
                                            "nome": "Clínica Capilar",
                                            "nome_legal": "Clínica Capilar, Lda.",
                                            "nif": "509999999",
                                            "ers_registo": "E123456",
                                            "licenca_numero": "12345/2025",
                                            "morada": "Avenida da Liberdade 100, 1250-001 Lisboa"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/consultas": {
            "post": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1CriarConsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "New consultation (draft)",
                "description": "Requires clinical access to the patient. Episode: the given one (same patient, otherwise 422), the patient active one or a new one. When a booking is already linked to a consultation, that consultation is returned. The history (past history, medication, allergies, habits, family history) is pre-filled from the last signed consultation; the doctor is assigned when a doctor creates it, otherwise the patient doctor. Returns the full screen package. Effects: episode at journey stage 3, timeline, «create» audit; when an episode is opened, episodio.aberto webhook. Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "primeira",
                                            "avaliacao",
                                            "controlo",
                                            "teleconsulta",
                                            "pre_operatoria"
                                        ],
                                        "default": "primeira"
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "marcacao_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "data": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "Defaults to now."
                                    }
                                },
                                "required": [
                                    "paciente_id"
                                ]
                            },
                            "example": {
                                "paciente_id": 1204,
                                "tipo": "primeira",
                                "episodio_id": 77,
                                "marcacao_id": 2051
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1PacoteConsulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/consultas/{id}": {
            "get": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1ObterConsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "Full consultation for the screen",
                "description": "Decrypted consultation, patient (minimal identification), episode, clinical alerts, live eligibility, graft range from the approved clinical table (zone × grade), pending AI proposals, previous consultations, latest pre-consultation questionnaire, permissions on the consultation, AI status for the patient and the prescription link (doctors only). Requires ficha.clinica ≥ view (or emergency access) and the patient in clinical scope. Read is audited («ver», consultas). Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1PacoteConsulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "put": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1GravarConsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Save draft fields",
                "description": "Screen autosave: only the fields sent change (closed list; others are ignored). Drafts only and with «edit» on ficha.clinica (signed consultation → 403; corrections go through addenda). Doctors and nurses record the history; diagnosis, differential diagnosis, scale, grade, BASP, PRECISE, scales, map, area, technique and sessions are doctor-only (sent by another profile → 422 on that field). Clinical texts up to 20,000 characters, encrypted at rest; scale and grade must be consistent. Recalculates and stores eligibility with the final values. Effects: «alterar» audit with the field list. Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/M1ConsultaEntrada"
                            },
                            "example": {
                                "alergias": "Penicilina.",
                                "medicacao": "Apixabano 5 mg.",
                                "escala": "norwood",
                                "grau": "IV",
                                "zonas": {
                                    "zonas": [
                                        "linha_frontal",
                                        "frontal",
                                        "coroa"
                                    ],
                                    "pontos": [
                                        {
                                            "x": 0.5,
                                            "y": 0.71,
                                            "nota": "Miniaturização visível"
                                        }
                                    ],
                                    "linha": [
                                        {
                                            "x": 0.3,
                                            "y": 0.14
                                        },
                                        {
                                            "x": 0.5,
                                            "y": 0.11
                                        },
                                        {
                                            "x": 0.7,
                                            "y": 0.14
                                        }
                                    ]
                                },
                                "tecnica": "FUE",
                                "sessoes_previstas": 1
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "consulta": {
                                                    "$ref": "#/components/schemas/M1Consulta"
                                                },
                                                "elegibilidade": {
                                                    "$ref": "#/components/schemas/M1Elegibilidade"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "consulta": {
                                            "id": 4410,
                                            "paciente_id": 1204,
                                            "episodio_id": 77,
                                            "marcacao_id": 2051,
                                            "medico_id": 7,
                                            "medico_nome": "Inês Valente",
                                            "tipo": "primeira",
                                            "tipo_rotulo": "Primeira consulta",
                                            "data": "2026-10-28T10:00:00+00:00",
                                            "estado": "rascunho",
                                            "estado_rotulo": "Rascunho",
                                            "escala": "norwood",
                                            "grau": "IV",
                                            "basp": null,
                                            "precise_pontuacao": 62.5,
                                            "miniaturizacao_dadora_pct": 12,
                                            "area": "couro_cabeludo",
                                            "tecnica": "FUE",
                                            "sessoes_previstas": 1,
                                            "zonas": {
                                                "zonas": [
                                                    "linha_frontal",
                                                    "frontal",
                                                    "coroa"
                                                ],
                                                "pontos": [
                                                    {
                                                        "x": 0.5,
                                                        "y": 0.71,
                                                        "nota": "Miniaturização visível"
                                                    }
                                                ],
                                                "linha": [
                                                    {
                                                        "x": 0.3,
                                                        "y": 0.14
                                                    },
                                                    {
                                                        "x": 0.5,
                                                        "y": 0.11
                                                    },
                                                    {
                                                        "x": 0.7,
                                                        "y": 0.14
                                                    }
                                                ]
                                            },
                                            "escalas": {
                                                "norwood": "IV"
                                            },
                                            "elegibilidade": "apto_condicional",
                                            "elegibilidade_rotulo": "Apto com condições",
                                            "alertas": [
                                                {
                                                    "regra_id": 12,
                                                    "nome": "Anticoagulante",
                                                    "nivel": "alerta",
                                                    "mensagem": "Confirmar a suspensão com o médico assistente.",
                                                    "origem": "regra"
                                                }
                                            ],
                                            "viabilidade": null,
                                            "viabilidade_validada_por": null,
                                            "viabilidade_validada_em": null,
                                            "assinada_em": null,
                                            "assinada_por": null,
                                            "impressao_digital": null,
                                            "aditamentos": [],
                                            "criado_em": "2026-10-28T09:58:00+00:00",
                                            "atualizado_em": "2026-10-28T10:21:00+00:00",
                                            "motivo": "Queda progressiva na zona frontal desde há 5 anos.",
                                            "antecedentes": "Sem antecedentes relevantes.",
                                            "medicacao": "Apixabano 5 mg.",
                                            "alergias": "Penicilina.",
                                            "habitos": "Não fumador.",
                                            "historia_familiar": "Pai com alopecia androgenética.",
                                            "expectativas": "Recuperar a linha frontal.",
                                            "exame": "Rarefação frontal e na coroa; zona dadora com boa densidade.",
                                            "diagnostico": "Alopecia androgenética, Norwood IV.",
                                            "diagnostico_diferencial": null,
                                            "notas": null
                                        },
                                        "elegibilidade": {
                                            "estado": "apto_condicional",
                                            "alertas": [
                                                {
                                                    "regra_id": 12,
                                                    "nome": "Anticoagulante",
                                                    "nivel": "alerta",
                                                    "mensagem": "Confirmar a suspensão com o médico assistente.",
                                                    "origem": "regra"
                                                }
                                            ],
                                            "regras_aprovadas": 9,
                                            "motor": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/consultas/{id}/aditamentos": {
            "post": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1AditarConsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Correction by addendum",
                "description": "Signed consultations only (otherwise 403). Appends, never rewrites: text of 1 to 5000 characters, encrypted, with author and date. Returns every addendum in chronological order. Effects: timeline, «alterar» audit. Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "texto": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 5000
                                    }
                                },
                                "required": [
                                    "texto"
                                ]
                            },
                            "example": {
                                "texto": "Onde se lê «coroa», deve ler-se «zona média»."
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M1Aditamento"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "texto": "Onde se lê «coroa», deve ler-se «zona média».",
                                            "autor_id": 7,
                                            "autor_nome": "Inês Valente",
                                            "em": "2026-10-29T09:12:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/consultas/{id}/assinar": {
            "post": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1AssinarConsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Sign the consultation (doctors)",
                "description": "Requires confirmar = true, a draft consultation, a doctor with «edit» on ficha.clinica and the consultation without a doctor, of the same doctor or with «all» scope (otherwise 403). Refuses (422) without examination or diagnosis. Stores the SHA-256 fingerprint of the canonical serialisation of the content (fields, signing time and doctor) and, if sent, the drawn signature (PNG data URL, up to 2 MB) as a private clinical file. Once signed nothing is rewritten: only addenda. Effects: timeline, «assinar» audit, consulta.assinada webhook. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "confirmar": {
                                        "const": true
                                    },
                                    "assinatura": {
                                        "type": "string",
                                        "pattern": "^data:image/png;base64,",
                                        "maxLength": 2800000,
                                        "description": "Drawn signature (optional)."
                                    }
                                },
                                "required": [
                                    "confirmar"
                                ]
                            },
                            "example": {
                                "confirmar": true,
                                "assinatura": "data:image/png;base64,iVBORw0KGgo…"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1Consulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 4410,
                                        "paciente_id": 1204,
                                        "episodio_id": 77,
                                        "marcacao_id": 2051,
                                        "medico_id": 7,
                                        "medico_nome": "Inês Valente",
                                        "tipo": "primeira",
                                        "tipo_rotulo": "Primeira consulta",
                                        "data": "2026-10-28T10:00:00+00:00",
                                        "estado": "assinada",
                                        "estado_rotulo": "Assinada",
                                        "escala": "norwood",
                                        "grau": "IV",
                                        "basp": null,
                                        "precise_pontuacao": 62.5,
                                        "miniaturizacao_dadora_pct": 12,
                                        "area": "couro_cabeludo",
                                        "tecnica": "FUE",
                                        "sessoes_previstas": 1,
                                        "zonas": {
                                            "zonas": [
                                                "linha_frontal",
                                                "frontal",
                                                "coroa"
                                            ],
                                            "pontos": [
                                                {
                                                    "x": 0.5,
                                                    "y": 0.71,
                                                    "nota": "Miniaturização visível"
                                                }
                                            ],
                                            "linha": [
                                                {
                                                    "x": 0.3,
                                                    "y": 0.14
                                                },
                                                {
                                                    "x": 0.5,
                                                    "y": 0.11
                                                },
                                                {
                                                    "x": 0.7,
                                                    "y": 0.14
                                                }
                                            ]
                                        },
                                        "escalas": {
                                            "norwood": "IV"
                                        },
                                        "elegibilidade": "apto_condicional",
                                        "elegibilidade_rotulo": "Apto com condições",
                                        "alertas": [
                                            {
                                                "regra_id": 12,
                                                "nome": "Anticoagulante",
                                                "nivel": "alerta",
                                                "mensagem": "Confirmar a suspensão com o médico assistente.",
                                                "origem": "regra"
                                            }
                                        ],
                                        "viabilidade": null,
                                        "viabilidade_validada_por": null,
                                        "viabilidade_validada_em": null,
                                        "assinada_em": "2026-10-28T10:45:00+00:00",
                                        "assinada_por": "Inês Valente",
                                        "impressao_digital": "9f2c1e7a54b3d8f60a1c2e3d4b5a69788c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f",
                                        "aditamentos": [],
                                        "criado_em": "2026-10-28T09:58:00+00:00",
                                        "atualizado_em": "2026-10-28T10:21:00+00:00",
                                        "motivo": "Queda progressiva na zona frontal desde há 5 anos.",
                                        "antecedentes": "Sem antecedentes relevantes.",
                                        "medicacao": "Apixabano 5 mg.",
                                        "alergias": "Penicilina.",
                                        "habitos": "Não fumador.",
                                        "historia_familiar": "Pai com alopecia androgenética.",
                                        "expectativas": "Recuperar a linha frontal.",
                                        "exame": "Rarefação frontal e na coroa; zona dadora com boa densidade.",
                                        "diagnostico": "Alopecia androgenética, Norwood IV.",
                                        "diagnostico_diferencial": null,
                                        "notas": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/consultas/{id}/completude": {
            "get": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1CompletudeConsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "Completeness check before surgery",
                "description": "What is done and what is missing in the episode: signed consultation, clinical notes, validated feasibility, validated pre-consultation questionnaire, validated alerts, photos, approved plan, surgical consent, accepted proposal and paid deposit. Each item: ok, falta or indisponivel (module absent), with the web and app link to resolve it. Statuses only — never commercial values nor other modules content. Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1Completude"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "itens": [
                                            {
                                                "chave": "consulta_assinada",
                                                "rotulo": "Consulta assinada",
                                                "estado": "ok",
                                                "estado_rotulo": "Feito",
                                                "detalhe": null,
                                                "ligacao": {
                                                    "web": "equipa/consulta?id=4410",
                                                    "app": "/e/consulta?id=4410"
                                                }
                                            },
                                            {
                                                "chave": "fotografias",
                                                "rotulo": "Fotografias",
                                                "estado": "ok",
                                                "estado_rotulo": "Feito",
                                                "detalhe": "6 fotografias",
                                                "ligacao": {
                                                    "web": "equipa/ficha?id=1204#fotografias",
                                                    "app": "/e/ficha_paciente?id=1204&seccao=fotografias"
                                                }
                                            },
                                            {
                                                "chave": "consentimento",
                                                "rotulo": "Consentimento cirúrgico",
                                                "estado": "falta",
                                                "estado_rotulo": "Em falta",
                                                "detalhe": null,
                                                "ligacao": {
                                                    "web": "equipa/ficha?id=1204#consentimentos",
                                                    "app": "/e/ficha_paciente?id=1204&seccao=consentimentos"
                                                }
                                            }
                                        ],
                                        "pronto": false,
                                        "em_falta": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/consultas/{id}/elegibilidade": {
            "post": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1ElegibilidadeConsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "Evaluate eligibility with unsaved values",
                "description": "Merges the posted values (only those used by the rules, up to 20,000 characters each) into the saved consultation and evaluates the clinic approved eligibility rules and the approved engine version limits (minimum age, alert age, maximum miniaturisation). Nothing is saved. Status: por_avaliar (no rules nor engine), nao_apto (any block), apto_condicional (any alert) or apto. Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "alergias": {
                                        "type": "string"
                                    },
                                    "medicacao": {
                                        "type": "string"
                                    },
                                    "antecedentes": {
                                        "type": "string"
                                    },
                                    "habitos": {
                                        "type": "string"
                                    },
                                    "miniaturizacao_dadora_pct": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100,
                                        "x-unidade": "%"
                                    },
                                    "precise_pontuacao": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100,
                                        "x-unidade": "%"
                                    },
                                    "escala": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "norwood",
                                            "ludwig",
                                            "savin",
                                            "sinclair",
                                            "basp",
                                            "outra",
                                            null
                                        ]
                                    },
                                    "grau": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "area": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "couro_cabeludo",
                                            "barba",
                                            "sobrancelhas",
                                            "feminina",
                                            "reparacao",
                                            "outra",
                                            null
                                        ]
                                    },
                                    "tecnica": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "FUE",
                                            "FUT",
                                            "DHI",
                                            "outra",
                                            null
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "medicacao": "Apixabano 5 mg",
                                "miniaturizacao_dadora_pct": 12,
                                "escala": "norwood",
                                "grau": "IV"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1Elegibilidade"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "estado": "apto_condicional",
                                        "alertas": [
                                            {
                                                "regra_id": 12,
                                                "nome": "Anticoagulante",
                                                "nivel": "alerta",
                                                "mensagem": "Confirmar a suspensão com o médico assistente.",
                                                "origem": "regra"
                                            }
                                        ],
                                        "regras_aprovadas": 9,
                                        "motor": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/consultas/{id}/escriba": {
            "post": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1EscribaConsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Scribe: proposals from the transcript",
                "description": "Draft consultations only. The consultation text (pasted or dictated, 20 to 40,000 characters) or a transcript file (.txt, .vtt or .srt, text, up to 1 MB; subtitle numbering and timings removed) is read and discarded — never stored. The assistant proposes each field (reason, history, examination, diagnosis, scale, grade, miniaturisation, notes) with the exact excerpt it comes from and the confidence; the server checks that the excerpt really is in the transcript (fatores.excerto_verificado). Proposals and excerpts are stored encrypted. Uses the clinic's AI assistant: requires a valid «ia» consent from the patient and the use to be configured (otherwise 422). The result is never a decision — each value becomes a pending proposal (ia_propostas) recording the model used, the request parameters and the explanatory factors, until a doctor accepts, corrects or refuses it. Doctors only («medico» profile family) with «edit» on ficha.clinica and the patient in clinical scope; other profiles receive 403. Effects: pending proposals, «create» audit on ia_propostas. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After). Additional limit: 30 requests per 10 minutes per IP address (only data-changing requests count).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "texto"
                                ],
                                "properties": {
                                    "texto": {
                                        "type": "string",
                                        "minLength": 20,
                                        "maxLength": 40000
                                    }
                                }
                            },
                            "example": {
                                "texto": "Médica: o que o traz cá? Paciente: estou a perder cabelo à frente há uns cinco anos… sou alérgico à penicilina, fiquei cheio de manchas."
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "Transcript .txt, .vtt or .srt (up to 1 MB); used only without «texto»."
                                    },
                                    "texto": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "lote": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "propostas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/M1PropostaIa"
                                                    }
                                                },
                                                "fornecedor": {
                                                    "type": "string",
                                                    "description": "Service that answered (the clinic local one or the external fallback)."
                                                },
                                                "modelo": {
                                                    "type": "string",
                                                    "description": "Model used (also recorded on each proposal)."
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "lote": "3f2a9c0d6b1e4a7f8c2d5e9b0a1f3c4d",
                                        "propostas": [
                                            {
                                                "id": 9120,
                                                "paciente_id": 1204,
                                                "episodio_id": 77,
                                                "consulta_id": 4410,
                                                "resposta_id": null,
                                                "tipo": "escriba",
                                                "tipo_rotulo": "Escriba",
                                                "campo": "alergias",
                                                "campo_rotulo": "Alergias",
                                                "valor_proposto": "Alergia a penicilina (exantema).",
                                                "excerto_origem": "sou alérgico à penicilina, fiquei cheio de manchas",
                                                "fatores": {
                                                    "excerto_verificado": true,
                                                    "confianca_modelo": 0.92
                                                },
                                                "confianca": 0.92,
                                                "estado": "pendente",
                                                "estado_rotulo": "Pendente",
                                                "valor_final": null,
                                                "decidido_por": null,
                                                "decidido_em": null,
                                                "motivo": null,
                                                "lote": "3f2a9c0d6b1e4a7f8c2d5e9b0a1f3c4d",
                                                "criado_em": "2026-10-28T10:22:00+00:00"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/consultas/{id}/escriba/audio": {
            "post": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1EscribaAudio",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Dictation scribe: transcribe one part of the consultation audio",
                "description": "Draft consultations and doctors only. One part of the audio (16 kHz mono WAV of ~45 s sent by the web and the app; also MP3, OGG, FLAC, WEBM or M4A, up to 4 MB and 2 minutes). Each part checks the patient «gravacao_video» (consultation recording) and «ia» consents — without them, 422 with code «consentimento_em_falta». The audio is transcribed («escriba» use, transcription type: local service first; external only with the patient-data switch) and discarded: it is never stored. The transcript is returned and not stored. Uses the clinic's AI assistant: requires a valid «ia» consent from the patient and the use to be configured (otherwise 422). The result is never a decision — each value becomes a pending proposal (ia_propostas) recording the model used, the request parameters and the explanatory factors, until a doctor accepts, corrects or refuses it. Doctors only («medico» profile family) with «edit» on ficha.clinica and the patient in clinical scope; other profiles receive 403. Effects: «create» audit on consultas with metrics only (part, seconds, bytes, service, characters). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After). Additional limit: 240 requests per 10 minutes per IP address (only data-changing requests count).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "parte": {
                                        "type": "integer"
                                    },
                                    "lingua": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "texto": {
                                                    "type": "string"
                                                },
                                                "segundos": {
                                                    "type": "integer"
                                                },
                                                "servico": {
                                                    "type": "string",
                                                    "enum": [
                                                        "local",
                                                        "externo"
                                                    ]
                                                },
                                                "parte": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "texto": "Paciente: estou a perder cabelo à frente há uns cinco anos.",
                                        "segundos": 45,
                                        "servico": "local",
                                        "parte": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/consultas/{id}/escriba/transcricao": {
            "get": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1EscribaTranscricaoLer",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Read the transcript saved by the doctor",
                "description": "Decrypted text (audited read) and metadata; null text when there is none. Doctors only («medico» profile family) with «edit» on ficha.clinica and the patient in clinical scope; other profiles receive 403.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "texto": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "gravada": {
                                                    "type": "boolean"
                                                },
                                                "em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "por": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "segundos": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "post": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1EscribaTranscricaoGravar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Save the transcript in the consultation (encrypted)",
                "description": "Draft consultations only. 20 to 40,000 characters, stored encrypted with the clinical key (replaces the previous one). Doctors only («medico» profile family) with «edit» on ficha.clinica and the patient in clinical scope; other profiles receive 403.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "texto": {
                                        "type": "string",
                                        "minLength": 20,
                                        "maxLength": 40000
                                    },
                                    "segundos": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "texto"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "gravada": {
                                                    "type": "boolean"
                                                },
                                                "em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "por": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "segundos": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/consultas/{id}/escriba/transcricao/apagar": {
            "post": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1EscribaTranscricaoApagar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Discard the saved transcript",
                "description": "Deletes the encrypted text and metadata; the audit records the act (without the text). Doctors only («medico» profile family) with «edit» on ficha.clinica and the patient in clinical scope; other profiles receive 403.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "gravada": {
                                                    "type": "boolean"
                                                },
                                                "em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "por": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "segundos": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/consultas/{id}/pre-analise": {
            "post": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1PreAnaliseConsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Photo pre-analysis",
                "description": "Up to 6 photos: those in ficheiro_ids (only images of the patient, or without owner, from the current clinic), or the most recent ones in the patient gallery (no simulations nor rejected), or those of the latest pre-assessment; no photos → 422. The assistant proposes scale and grade, a graft range (as a notes proposal) and the donor area status (examination proposal), following the approved engine clinical table when available; justification, observations and photos used are kept in the factors. Uses the clinic's AI assistant: requires a valid «ia» consent from the patient and the use to be configured (otherwise 422). The result is never a decision — each value becomes a pending proposal (ia_propostas) recording the model used, the request parameters and the explanatory factors, until a doctor accepts, corrects or refuses it. Doctors only («medico» profile family) with «edit» on ficha.clinica and the patient in clinical scope; other profiles receive 403. Effects: pending proposals, «create» audit on ia_propostas. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After). Additional limit: 20 requests per 10 minutes per IP address (only data-changing requests count).",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "ficheiro_ids": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "description": "The first 6 are used (duplicates removed); empty = most recent photos."
                                    }
                                }
                            },
                            "example": {
                                "ficheiro_ids": [
                                    8812,
                                    8813,
                                    8814
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "lote": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "propostas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/M1PropostaIa"
                                                    }
                                                },
                                                "fotos": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 6
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/consultas/{id}/viabilidade": {
            "post": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1ViabilidadeConsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Consultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Validate feasibility (doctors)",
                "description": "Records the decision, who decided and when. The note goes into the notes (draft) or as an addendum (signed). With the episode in «avaliacao»: «viavel» moves it to «plano» (stage 4) and «nao_viavel» closes it as «cancelado»; «condicional» keeps it. Returns the consultation and the episode in the M1Episodio shape (no clinical content, with the active team), or null without an episode. Effects: timeline, «aprovar» audit; on a status change, automatic tasks for the status and episodio.estado_alterado webhook. Doctors only («medico» profile family) with «edit» on ficha.clinica and the patient in clinical scope; other profiles receive 403. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "viavel",
                                            "condicional",
                                            "nao_viavel"
                                        ]
                                    },
                                    "nota": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "viavel",
                                "nota": "Dadora suficiente para uma sessão."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "consulta": {
                                                    "$ref": "#/components/schemas/M1Consulta"
                                                },
                                                "episodio": {
                                                    "oneOf": [
                                                        {
                                                            "$ref": "#/components/schemas/M1Episodio"
                                                        },
                                                        {
                                                            "type": "null"
                                                        }
                                                    ],
                                                    "description": "Episode after the decision (same shape as the record)."
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/crm/agente": {
            "get": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmPedidosAgente",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "ver",
                "summary": "Agent requests",
                "description": "Requests handled by the voice agent and the written assistants. Open ones by default; todos=1 includes resolved ones. meta has the counts per status, this month's usage and whether the assistant is configured.",
                "parameters": [
                    {
                        "name": "estado",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "ia_a_tratar",
                                "passado_equipa",
                                "resolvido",
                                "validado"
                            ]
                        },
                        "description": "Status"
                    },
                    {
                        "name": "tipo",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "marcacao",
                                "informacao",
                                "pos_operatorio",
                                "pagamento",
                                "alarme",
                                "outro"
                            ]
                        },
                        "description": "Type"
                    },
                    {
                        "name": "canal",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "voz",
                                "whatsapp",
                                "chat"
                            ]
                        },
                        "description": "Channel"
                    },
                    {
                        "name": "alarme",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        },
                        "description": "Alarm signs only"
                    },
                    {
                        "name": "amostra",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        },
                        "description": "Review samples only"
                    },
                    {
                        "name": "todos",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        },
                        "description": "Include resolved"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/CrmPedidoAgente"
                                            }
                                        },
                                        "meta": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Meta"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "contagens": {
                                                            "type": "object"
                                                        },
                                                        "consumo": {
                                                            "$ref": "#/components/schemas/CrmConsumoAgente"
                                                        },
                                                        "configurado": {
                                                            "type": "boolean"
                                                        },
                                                        "motor": {
                                                            "type": "string",
                                                            "enum": [
                                                                "externo",
                                                                "proprio"
                                                            ],
                                                            "description": "Clinic voice engine (Settings › crm.agente.motor)."
                                                        },
                                                        "voz_configurada": {
                                                            "type": "boolean",
                                                            "description": "The own engine can answer (otherwise calls are handed to a person)."
                                                        }
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 77,
                                            "canal": "voz",
                                            "canal_rotulo": "Voz",
                                            "tipo": "marcacao",
                                            "tipo_rotulo": "Marcação",
                                            "estado": "passado_equipa",
                                            "estado_rotulo": "Com a equipa",
                                            "pessoa": {
                                                "tipo": "paciente",
                                                "id": 702,
                                                "nome": "Helena Duarte"
                                            },
                                            "nome": "Helena Duarte",
                                            "telefone": "+351936000111",
                                            "intencao": "Remarcar consulta de revisão",
                                            "proximo_passo": "Receção propõe nova data",
                                            "sinal_alarme": false,
                                            "resumo": "Pede para mudar a consulta de quinta para a semana seguinte.",
                                            "resumo_reservado": false,
                                            "idioma": "pt-PT",
                                            "duracao_s": 143,
                                            "aviso_ia": true,
                                            "identificacao_verificada": true,
                                            "amostra": false,
                                            "revisao_estado": null,
                                            "conversa_id": null,
                                            "marcacao_id": null,
                                            "assumido_por": null,
                                            "criado_em": "2026-10-27T21:14:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/crm/agente/saida": {
            "get": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmAgenteSaida",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "ver",
                "summary": "Agent outbound calls",
                "description": "Dialler lists called by the voice agent: progress, calls in progress, window and whether it can call now (with the reason when it cannot).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "instalado": {
                                                    "type": "boolean"
                                                },
                                                "ativo": {
                                                    "type": "boolean"
                                                },
                                                "empurra": {
                                                    "type": "boolean"
                                                },
                                                "listas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "nome": {
                                                                "type": "string"
                                                            },
                                                            "tipo": {
                                                                "type": "string"
                                                            },
                                                            "tipo_rotulo": {
                                                                "type": "string"
                                                            },
                                                            "estado": {
                                                                "type": "string"
                                                            },
                                                            "estado_rotulo": {
                                                                "type": "string"
                                                            },
                                                            "total": {
                                                                "type": "integer"
                                                            },
                                                            "concluidos": {
                                                                "type": "integer"
                                                            },
                                                            "bloqueados": {
                                                                "type": "integer"
                                                            },
                                                            "em_curso": {
                                                                "type": "integer"
                                                            },
                                                            "pode_ligar_agora": {
                                                                "type": "boolean"
                                                            },
                                                            "motivo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "motivo_rotulo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "janela": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/crm/agente/testes": {
            "get": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmAgenteTestes",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "ver",
                "summary": "Agent tests",
                "description": "Test conversations, unpublished knowledge base drafts, current rules, latest runs and whether tests are mandatory.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "testes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "rascunhos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "execucoes": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/CrmExecucaoTestes"
                                                    }
                                                },
                                                "regras": {
                                                    "type": "object",
                                                    "properties": {
                                                        "temas_proibidos": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "alarmes": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                },
                                                "obrigatorios": {
                                                    "type": "boolean"
                                                },
                                                "pode_editar": {
                                                    "type": "boolean"
                                                },
                                                "pode_aprovar_clinico": {
                                                    "type": "boolean"
                                                },
                                                "canais": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "linguas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmAgenteTesteCriar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "summary": "Create a test conversation",
                "description": "«falas»: one per line, «Agente:» before the agent ones; the last one is from the person. The text is cleaned of personal data before being stored.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "titulo": {
                                        "type": "string"
                                    },
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "voz",
                                            "escrito"
                                        ]
                                    },
                                    "lingua": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    },
                                    "falas": {
                                        "type": "string"
                                    },
                                    "deve_conter": {
                                        "type": "string"
                                    },
                                    "nao_deve_conter": {
                                        "type": "string"
                                    },
                                    "passar_equipa": {
                                        "type": "string",
                                        "enum": [
                                            "sim",
                                            "nao",
                                            "indiferente"
                                        ]
                                    },
                                    "sinal_alarme": {
                                        "type": "string",
                                        "enum": [
                                            "sim",
                                            "nao",
                                            "indiferente"
                                        ]
                                    },
                                    "ativo": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "titulo",
                                    "falas"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/agente/testes/execucoes": {
            "post": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmAgenteExecucaoCriar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "summary": "Run the tests against the new version",
                "description": "Chosen drafts and/or proposed rules (only those different from the current ones count). Runs in the background (scheduler crm.agente_testes): each active conversation is answered by the current and the new version. 422 without target or without test conversations.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "artigos": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    },
                                    "temas_proibidos": {
                                        "type": "string"
                                    },
                                    "alarmes": {
                                        "type": "string"
                                    },
                                    "titulo": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmExecucaoTestes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/agente/testes/execucoes/{id}": {
            "get": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmAgenteExecucao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "ver",
                "summary": "A run with the comparison",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmExecucaoTestes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/agente/testes/execucoes/{id}/decisao": {
            "post": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmAgenteExecucaoDecidir",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "summary": "Approve and publish, or reject",
                "description": "«aprovada»: the tested drafts become approved (clinical content only by clinical management; a draft changed after the run gives 409) and the proposed rules go to Settings. Audited.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "aprovada",
                                            "rejeitada"
                                        ]
                                    },
                                    "nota": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmExecucaoTestes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/agente/testes/{id}": {
            "put": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmAgenteTesteGravar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "summary": "Update a test conversation",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "titulo": {
                                        "type": "string"
                                    },
                                    "canal": {
                                        "type": "string"
                                    },
                                    "lingua": {
                                        "type": "string"
                                    },
                                    "falas": {
                                        "type": "string"
                                    },
                                    "deve_conter": {
                                        "type": "string"
                                    },
                                    "nao_deve_conter": {
                                        "type": "string"
                                    },
                                    "passar_equipa": {
                                        "type": "string"
                                    },
                                    "sinal_alarme": {
                                        "type": "string"
                                    },
                                    "ativo": {
                                        "type": "boolean"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/agente/{id}": {
            "get": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmPedidoAgente",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "ver",
                "summary": "Request detail",
                "description": "Transcript, patient-reported notes, detected signs and recording only for users who can see the clinical record. Read is audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmPedidoAgente"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 77,
                                        "canal": "voz",
                                        "canal_rotulo": "Voz",
                                        "tipo": "marcacao",
                                        "tipo_rotulo": "Marcação",
                                        "estado": "passado_equipa",
                                        "estado_rotulo": "Com a equipa",
                                        "pessoa": {
                                            "tipo": "paciente",
                                            "id": 702,
                                            "nome": "Helena Duarte"
                                        },
                                        "nome": "Helena Duarte",
                                        "telefone": "+351936000111",
                                        "intencao": "Remarcar consulta de revisão",
                                        "proximo_passo": "Receção propõe nova data",
                                        "sinal_alarme": false,
                                        "resumo": "Pede para mudar a consulta de quinta para a semana seguinte.",
                                        "resumo_reservado": false,
                                        "idioma": "pt-PT",
                                        "duracao_s": 143,
                                        "aviso_ia": true,
                                        "identificacao_verificada": true,
                                        "amostra": false,
                                        "revisao_estado": null,
                                        "conversa_id": null,
                                        "marcacao_id": null,
                                        "assumido_por": null,
                                        "criado_em": "2026-10-27T21:14:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/agente/{id}/assumir": {
            "post": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmAssumirPedido",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "ver",
                "summary": "Take over the request",
                "description": "Hands the request to the team («passado_equipa»), records who took it and, if there is a written conversation, removes it from the assistant.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmPedidoAgente"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/agente/{id}/correcao": {
            "post": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmCorrigirAgente",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "ver",
                "summary": "Correct an agent answer",
                "description": "Creates a knowledge-base draft («correção» category) linked to this request. Only used after approval; clinical content only by the clinical board. Effects: notification to approvers.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "titulo": {
                                        "type": "string",
                                        "maxLength": 190
                                    },
                                    "texto": {
                                        "type": "string",
                                        "maxLength": 8000
                                    },
                                    "clinico": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "titulo",
                                    "texto"
                                ]
                            },
                            "example": {
                                "titulo": "Estacionamento",
                                "texto": "A clínica tem estacionamento gratuito para pacientes no piso -1.",
                                "clinico": false
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "base_conhecimento_id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "base_conhecimento_id": 48
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/agente/{id}/resolver": {
            "post": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmResolverPedido",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "ver",
                "summary": "Resolve the request",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmPedidoAgente"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/agente/{id}/revisao": {
            "post": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmReverPedido",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "summary": "Review a sample",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "conforme",
                                            "a_corrigir"
                                        ]
                                    },
                                    "nota": {
                                        "type": "string",
                                        "maxLength": 1000
                                    }
                                },
                                "required": [
                                    "estado"
                                ]
                            },
                            "example": {
                                "estado": "a_corrigir",
                                "nota": "Não ofereceu falar com uma pessoa."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmPedidoAgente"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/agente/{id}/teste": {
            "post": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmAgenteTesteDoPedido",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "summary": "Create a test conversation from a request",
                "description": "Uses the conversation version without personal data (voice engine turns or transcript).",
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "teste_id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/agente/{id}/validar": {
            "post": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmValidarNotas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "ver",
                "summary": "Validate the patient-reported notes",
                "description": "Clinical team only (403 for others). May correct the text. The request becomes «validado».",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "notas": {
                                        "type": "string",
                                        "maxLength": 8000
                                    }
                                }
                            },
                            "example": {
                                "notas": "Refere ligeiro ardor na zona recetora ao terceiro dia, sem febre."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmPedidoAgente"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/chamadas/estatisticas": {
            "get": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmEstatisticasChamadas",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "ver",
                "summary": "Call statistics",
                "description": "Per person (answered, missed, out of hours, outbound, average callback time), calls to return in the last 7 days and heat map of inbound calls by weekday and hour.",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Start"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "End"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmEstatisticasChamadas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/crm/conversas": {
            "get": {
                "tags": [
                    "Caixa de entrada"
                ],
                "operationId": "crmListarConversas",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "ver",
                "summary": "Inbox",
                "description": "Conversations from every channel, newest first. meta.contagens has the count per queue (minhas, por_atribuir, ia, atrasadas, todas).",
                "parameters": [
                    {
                        "name": "fila",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "minhas",
                                "por_atribuir",
                                "ia",
                                "atrasadas",
                                "todas",
                                "resolvidas"
                            ],
                            "default": "todas"
                        },
                        "description": "Queue"
                    },
                    {
                        "name": "canal",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "portal",
                                "whatsapp",
                                "instagram",
                                "messenger",
                                "email",
                                "chat_site",
                                "sms"
                            ]
                        },
                        "description": "Channel"
                    },
                    {
                        "name": "estado",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "aberta",
                                "pendente",
                                "resolvida"
                            ]
                        },
                        "description": "Status"
                    },
                    {
                        "name": "departamento",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "administracao",
                                "medico",
                                "enfermagem",
                                "tecnico",
                                "comercial",
                                "rececao"
                            ]
                        },
                        "description": "Department"
                    },
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/CrmConversaLinha"
                                            }
                                        },
                                        "meta": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Meta"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "contagens": {
                                                            "type": "object",
                                                            "additionalProperties": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 301,
                                            "canal": "whatsapp",
                                            "canal_rotulo": "WhatsApp",
                                            "contacto": "+351912345678",
                                            "pessoa": {
                                                "tipo": "lead",
                                                "id": 812,
                                                "nome": "Ricardo Almeida"
                                            },
                                            "estado": "aberta",
                                            "estado_rotulo": "Aberta",
                                            "departamento": "comercial",
                                            "departamento_rotulo": "Comercial",
                                            "atribuida_a": {
                                                "id": 14,
                                                "nome": "Sofia Martins",
                                                "cor": "#8b5cf6"
                                            },
                                            "ia_a_tratar": false,
                                            "aguarda_resposta": true,
                                            "sla_ate": "2026-10-28T09:42:00+00:00",
                                            "atrasada": false,
                                            "ultima_mensagem_em": "2026-10-28T09:27:00+00:00",
                                            "previa": "Boa tarde, qual é o preço aproximado para a zona da coroa?",
                                            "assunto": null,
                                            "idioma": "pt-PT",
                                            "avaliacao": null
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/crm/conversas/{id}": {
            "get": {
                "tags": [
                    "Caixa de entrada"
                ],
                "operationId": "crmObterConversa",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "ver",
                "summary": "Conversation with messages",
                "description": "Up to 400 messages, internal notes included. With depois_de only new messages are returned (to refresh without reloading). Clinical-department content and photos filtered by permissions. First read is audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "depois_de",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Only messages with an id above this one."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmConversaDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 301,
                                        "canal": "whatsapp",
                                        "canal_rotulo": "WhatsApp",
                                        "contacto": "+351912345678",
                                        "pessoa": {
                                            "tipo": "lead",
                                            "id": 812,
                                            "nome": "Ricardo Almeida"
                                        },
                                        "estado": "aberta",
                                        "estado_rotulo": "Aberta",
                                        "departamento": "comercial",
                                        "departamento_rotulo": "Comercial",
                                        "atribuida_a": {
                                            "id": 14,
                                            "nome": "Sofia Martins",
                                            "cor": "#8b5cf6"
                                        },
                                        "ia_a_tratar": false,
                                        "aguarda_resposta": true,
                                        "sla_ate": "2026-10-28T09:42:00+00:00",
                                        "atrasada": false,
                                        "ultima_mensagem_em": "2026-10-28T09:27:00+00:00",
                                        "previa": "Boa tarde, qual é o preço aproximado para a zona da coroa?",
                                        "assunto": null,
                                        "idioma": "pt-PT",
                                        "avaliacao": null,
                                        "mensagens": [
                                            {
                                                "id": 9921,
                                                "direcao": "saida",
                                                "autor_tipo": "equipa",
                                                "autor": {
                                                    "id": 14,
                                                    "nome": "Sofia Martins",
                                                    "cor": "#8b5cf6"
                                                },
                                                "canal": "whatsapp",
                                                "corpo": "Olá Ricardo! O valor depende da avaliação. Podemos marcar uma consulta gratuita esta semana?",
                                                "traducao": null,
                                                "anexos": [],
                                                "estado_entrega": "entregue",
                                                "estado_entrega_rotulo": "Entregue",
                                                "idioma": "pt-PT",
                                                "ia": false,
                                                "criado_em": "2026-10-28T09:31:00+00:00"
                                            }
                                        ],
                                        "conteudo_visivel": true,
                                        "outras_conversas": [],
                                        "transferencias": [],
                                        "avaliacao_comentario": null,
                                        "respostas_rapidas": [
                                            {
                                                "id": 2,
                                                "titulo": "Horário",
                                                "atalho": "/horario",
                                                "corpo": "Estamos abertos de segunda a sexta, das 9h às 19h."
                                            }
                                        ],
                                        "canais_reenvio": [
                                            "sms",
                                            "email"
                                        ],
                                        "ia": {
                                            "traducao": true,
                                            "respostas": true
                                        },
                                        "pode_editar": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/conversas/{id}/assumir": {
            "post": {
                "tags": [
                    "Caixa de entrada"
                ],
                "operationId": "crmAssumirConversa",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "summary": "Take over the conversation",
                "description": "Team members only. Assigns the conversation to the caller and turns off the virtual assistant for it.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmConversaDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/conversas/{id}/atribuir": {
            "post": {
                "tags": [
                    "Caixa de entrada"
                ],
                "operationId": "crmAtribuirConversa",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "summary": "Assign to a person",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "utilizador_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "utilizador_id": 14
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 301
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/conversas/{id}/avaliacao": {
            "post": {
                "tags": [
                    "Caixa de entrada"
                ],
                "operationId": "crmComentarAvaliacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "summary": "Supervisor comment on the rating",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "comentario": {
                                        "type": "string",
                                        "maxLength": 1000
                                    }
                                },
                                "required": [
                                    "comentario"
                                ]
                            },
                            "example": {
                                "comentario": "Resposta rápida e clara. Usar a resposta rápida do horário."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 301
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/conversas/{id}/estado": {
            "post": {
                "tags": [
                    "Caixa de entrada"
                ],
                "operationId": "crmEstadoConversa",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "summary": "Change status",
                "description": "When resolving, if enabled by the clinic, asks the contact for a 1-5 rating. A new message reopens the conversation.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "aberta",
                                            "pendente",
                                            "resolvida"
                                        ]
                                    }
                                },
                                "required": [
                                    "estado"
                                ]
                            },
                            "example": {
                                "estado": "resolvida"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "estado": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 301,
                                        "estado": "resolvida"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/conversas/{id}/mensagens": {
            "post": {
                "tags": [
                    "Caixa de entrada"
                ],
                "operationId": "crmResponderConversa",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "summary": "Reply or add an internal note",
                "description": "With nota=true stores a team-only note. Without it, sends through the conversation channel (or the given «canal») via the platform delivery service, which applies quiet hours, the opt-out list and the WhatsApp 24 h window. «original» keeps the text before translation. Effects: first response and target time updated, sequences stop, delivery status tracked from channel callbacks, audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "corpo": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 4000
                                    },
                                    "nota": {
                                        "type": "boolean"
                                    },
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "portal",
                                            "whatsapp",
                                            "instagram",
                                            "messenger",
                                            "email",
                                            "chat_site",
                                            "sms"
                                        ]
                                    },
                                    "original": {
                                        "type": "string",
                                        "maxLength": 4000
                                    },
                                    "anexos": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "ficheiro_id": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    },
                                    "ia_pedido_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "corpo"
                                ]
                            },
                            "example": {
                                "corpo": "Olá Ricardo! O valor depende da avaliação. Podemos marcar uma consulta gratuita esta semana?"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmMensagem"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 9921,
                                        "direcao": "saida",
                                        "autor_tipo": "equipa",
                                        "autor": {
                                            "id": 14,
                                            "nome": "Sofia Martins",
                                            "cor": "#8b5cf6"
                                        },
                                        "canal": "whatsapp",
                                        "corpo": "Olá Ricardo! O valor depende da avaliação. Podemos marcar uma consulta gratuita esta semana?",
                                        "traducao": null,
                                        "anexos": [],
                                        "estado_entrega": "entregue",
                                        "estado_entrega_rotulo": "Entregue",
                                        "idioma": "pt-PT",
                                        "ia": false,
                                        "criado_em": "2026-10-28T09:31:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/conversas/{id}/mensagens/{mensagem_id}/reenviar": {
            "post": {
                "tags": [
                    "Caixa de entrada"
                ],
                "operationId": "crmReenviarMensagem",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "mensagem_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "summary": "Resend a failed message",
                "description": "Resends through the given channel (one of the conversation's canais_reenvio) or the same channel.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "portal",
                                            "whatsapp",
                                            "instagram",
                                            "messenger",
                                            "email",
                                            "chat_site",
                                            "sms"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "canal": "sms"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmMensagem"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/conversas/{id}/sugerir": {
            "post": {
                "tags": [
                    "Caixa de entrada"
                ],
                "operationId": "crmSugerirResposta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "summary": "AI reply draft",
                "description": "Draft based on the history and the approved knowledge base («respostas» use). Never sent without review. 403 if the conversation content is reserved to the clinical team. Limit: 30 per minute.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "texto": {
                                                    "type": "string"
                                                },
                                                "erro": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "pedido_id": {
                                                    "type": "integer"
                                                },
                                                "fornecedor": {
                                                    "type": "string"
                                                },
                                                "modelo": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "texto": "Olá Ricardo! O valor depende da avaliação da zona e da área dadora. Podemos marcar uma consulta de avaliação esta semana?",
                                        "erro": null,
                                        "pedido_id": 5522,
                                        "fornecedor": "local",
                                        "modelo": "definido nas Definições"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/crm/conversas/{id}/traduzir": {
            "post": {
                "tags": [
                    "Caixa de entrada"
                ],
                "operationId": "crmTraduzir",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "summary": "Translate a text before sending",
                "description": "Uses the AI assistant configured for the «traducao» use (local service, then the external fallback). By default translates into the conversation language. 409 when the assistant is not configured or did not answer. Limit: 60 per minute.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "texto": {
                                        "type": "string",
                                        "maxLength": 6000
                                    },
                                    "para": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    }
                                },
                                "required": [
                                    "texto"
                                ]
                            },
                            "example": {
                                "texto": "Podemos marcar a avaliação para quinta-feira às 15h?",
                                "para": "fr"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "texto": {
                                                    "type": "string"
                                                },
                                                "idioma_origem": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "pedido_id": {
                                                    "type": "integer"
                                                },
                                                "fornecedor": {
                                                    "type": "string"
                                                },
                                                "modelo": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "texto": "Pouvons-nous fixer l'évaluation jeudi à 15 h ?",
                                        "idioma_origem": "pt",
                                        "pedido_id": 5521,
                                        "fornecedor": "local",
                                        "modelo": "definido nas Definições"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/crm/conversas/{id}/transferir": {
            "post": {
                "tags": [
                    "Caixa de entrada"
                ],
                "operationId": "crmTransferirConversa",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "summary": "Transfer to another department",
                "description": "Clears the owner, records the transfer and leaves a note. Effects: department notification, audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "departamento": {
                                        "type": "string",
                                        "enum": [
                                            "administracao",
                                            "medico",
                                            "enfermagem",
                                            "tecnico",
                                            "comercial",
                                            "rececao"
                                        ]
                                    },
                                    "nota": {
                                        "type": "string",
                                        "maxLength": 500
                                    }
                                },
                                "required": [
                                    "departamento"
                                ]
                            },
                            "example": {
                                "departamento": "enfermagem",
                                "nota": "Descreve vermelhidão na zona dadora."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 301
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/funil": {
            "get": {
                "tags": [
                    "Funil e leads"
                ],
                "operationId": "crmFunil",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "ver",
                "summary": "Funnel board",
                "description": "Stages with lead cards, totals, indicators (open, unanswered past target, stalled proposals, won this month, open value), this month's goals and filter options. Respects the module scope: sales users with «own» scope see their leads and unassigned ones.",
                "parameters": [
                    {
                        "name": "f",
                        "in": "query",
                        "style": "deepObject",
                        "explode": true,
                        "schema": {
                            "type": "object",
                            "properties": {
                                "responsavel_id": {
                                    "type": "string",
                                    "description": "Identifier, «eu» (me) or «sem» (unassigned)."
                                },
                                "origem": {
                                    "type": "string",
                                    "enum": [
                                        "site",
                                        "pre_avaliacao",
                                        "meta",
                                        "google",
                                        "whatsapp",
                                        "instagram",
                                        "messenger",
                                        "telefone",
                                        "presencial",
                                        "recomendacao",
                                        "agente_voz",
                                        "outro"
                                    ]
                                },
                                "procedimento_id": {
                                    "type": "integer"
                                },
                                "decisao": {
                                    "type": "string",
                                    "enum": [
                                        "por_decidir",
                                        "confirmado",
                                        "indeciso",
                                        "recusado"
                                    ]
                                },
                                "de": {
                                    "type": "string",
                                    "format": "date"
                                },
                                "ate": {
                                    "type": "string",
                                    "format": "date"
                                },
                                "pontuacao_min": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 100
                                },
                                "sla": {
                                    "type": "string",
                                    "enum": [
                                        "atrasado"
                                    ]
                                }
                            }
                        },
                        "description": "Filters: f[origem]=meta&f[sla]=atrasado…"
                    },
                    {
                        "$ref": "#/components/parameters/Q"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmFunil"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "fases": [
                                            {
                                                "id": 2,
                                                "nome": "Contactado",
                                                "chave": "contactado",
                                                "tipo": "aberta",
                                                "cor": "#3b82f6",
                                                "sla_horas": 24,
                                                "total": 1,
                                                "valor": 4200,
                                                "cartoes": [
                                                    {
                                                        "id": 812,
                                                        "nome": "Ricardo Almeida",
                                                        "responsavel": {
                                                            "id": 14,
                                                            "nome": "Sofia Martins",
                                                            "cor": "#8b5cf6"
                                                        },
                                                        "origem": "meta",
                                                        "origem_rotulo": "Meta (anúncios)",
                                                        "procedimento": {
                                                            "id": 3,
                                                            "nome": "Transplante capilar FUE"
                                                        },
                                                        "proxima_acao": "Ligar para marcar consulta",
                                                        "proxima_acao_em": "2026-10-29T10:00:00+00:00",
                                                        "sla_ate": null,
                                                        "sla_atrasado": false,
                                                        "decisao": "indeciso",
                                                        "decisao_rotulo": "Indeciso",
                                                        "motivo_indecisao": "Quer decidir depois do verão.",
                                                        "valor": 4200,
                                                        "valor_em_risco": true,
                                                        "pontuacao": 55,
                                                        "proposta_parada": false,
                                                        "duplicado": false,
                                                        "paciente_id": null,
                                                        "dias_na_fase": 1,
                                                        "motivo_perda": null,
                                                        "motivo_perda_rotulo": null
                                                    }
                                                ]
                                            }
                                        ],
                                        "total": 1,
                                        "kpis": {
                                            "abertos": 37,
                                            "por_responder": 2,
                                            "paradas": 4,
                                            "ganhos_mes": 6,
                                            "valor_aberto": 98400
                                        },
                                        "pode_valores": true,
                                        "pode_editar": true,
                                        "objetivos": [
                                            {
                                                "id": 1,
                                                "metrica": "consultas_marcadas",
                                                "rotulo": "Consultas marcadas",
                                                "quem": "Sofia Martins",
                                                "alvo": 20,
                                                "atual": 13,
                                                "percentagem": 65,
                                                "moeda": false
                                            }
                                        ],
                                        "motivos_perda": [
                                            {
                                                "valor": "preco",
                                                "rotulo": "Preço"
                                            }
                                        ],
                                        "filtros": [],
                                        "ativos": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/crm/funil/tempos": {
            "get": {
                "tags": [
                    "Funil e leads"
                ],
                "operationId": "crmFunilTempos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "ver",
                "summary": "Time in each funnel stage",
                "description": "Average per stage and owner of the stays that ended in the period (default: 90 days), plus leads still in each stage. A stay counts for whoever owns the lead when it leaves the stage. Also included in GET /crm/funil («tempos», «kpis.ciclo_medio_segundos» and each column's average).",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Start"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "End"
                    },
                    {
                        "name": "funil_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Market funnel (0 = main)"
                    },
                    {
                        "name": "responsavel_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Only this person"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmTemposFases"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/crm/leads": {
            "post": {
                "tags": [
                    "Funil e leads"
                ],
                "operationId": "crmCriarLead",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "summary": "Create a lead (external forms, ads)",
                "description": "Entry point for external forms and lead ads (Meta, Google). Normalises phone and email; the tax number is kept only as a search code. The same phone or email as an open lead updates that lead instead of duplicating it (and returns it); weak matches create the lead flagged «possible duplicate»; a recognised patient is linked. Then: initial stage, distribution (round robin or rules, skipping absences), first-response target time, score. Effects: timeline, stage tasks, sequence enrolment, owner notification, audit and lead.criado webhook.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "origem": {
                                        "type": "string",
                                        "enum": [
                                            "site",
                                            "pre_avaliacao",
                                            "meta",
                                            "google",
                                            "whatsapp",
                                            "instagram",
                                            "messenger",
                                            "telefone",
                                            "presencial",
                                            "recomendacao",
                                            "agente_voz",
                                            "outro"
                                        ]
                                    },
                                    "nome": {
                                        "type": "string",
                                        "maxLength": 160
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "maxLength": 190
                                    },
                                    "telefone": {
                                        "type": "string",
                                        "maxLength": 30,
                                        "description": "With country code; Portuguese numbers without one get +351."
                                    },
                                    "data_nascimento": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "nif": {
                                        "type": "string",
                                        "maxLength": 20
                                    },
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    },
                                    "pais": {
                                        "type": "string",
                                        "pattern": "^[A-Za-z]{2}$"
                                    },
                                    "procedimento_id": {
                                        "type": "integer"
                                    },
                                    "campanha": {
                                        "type": "string",
                                        "maxLength": 120
                                    },
                                    "anuncio": {
                                        "type": "string",
                                        "maxLength": 120
                                    },
                                    "utm_source": {
                                        "type": "string"
                                    },
                                    "utm_medium": {
                                        "type": "string"
                                    },
                                    "utm_campaign": {
                                        "type": "string"
                                    },
                                    "utm_term": {
                                        "type": "string"
                                    },
                                    "utm_content": {
                                        "type": "string"
                                    },
                                    "clique_id": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "description": "Ad click identifier (gclid, fbclid…)."
                                    },
                                    "consentimento_contacto": {
                                        "type": "boolean"
                                    },
                                    "recomendado_por_id": {
                                        "type": "integer"
                                    },
                                    "responsavel_id": {
                                        "type": "integer"
                                    },
                                    "notas": {
                                        "type": "string",
                                        "maxLength": 4000
                                    }
                                },
                                "required": [
                                    "origem"
                                ]
                            },
                            "example": {
                                "origem": "meta",
                                "nome": "Ricardo Almeida",
                                "email": "ricardo.almeida@exemplo.pt",
                                "telefone": "912345678",
                                "idioma": "pt-PT",
                                "procedimento_id": 3,
                                "campanha": "capilar-outono",
                                "utm_source": "facebook",
                                "utm_medium": "cpc",
                                "utm_campaign": "capilar-outono",
                                "clique_id": "fb.1.1730100000.AbCdEf",
                                "consentimento_contacto": true
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmLeadDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 812,
                                        "nome": "Ricardo Almeida",
                                        "email": "ricardo.almeida@exemplo.pt",
                                        "telefone": "+351912345678",
                                        "tel": "tel:+351912345678",
                                        "data_nascimento": null,
                                        "idioma": "pt-PT",
                                        "origem": "meta",
                                        "origem_rotulo": "Meta (anúncios)",
                                        "campanha": "capilar-outono",
                                        "utm": {
                                            "source": "facebook",
                                            "medium": "cpc",
                                            "campaign": "capilar-outono"
                                        },
                                        "procedimento": {
                                            "id": 3,
                                            "nome": "Transplante capilar FUE"
                                        },
                                        "fase": {
                                            "id": 2,
                                            "nome": "Contactado",
                                            "tipo": "aberta",
                                            "cor": "#3b82f6"
                                        },
                                        "responsavel": {
                                            "id": 14,
                                            "nome": "Sofia Martins",
                                            "cor": "#8b5cf6"
                                        },
                                        "pontuacao": 55,
                                        "decisao": "indeciso",
                                        "decisao_rotulo": "Indeciso",
                                        "motivo_indecisao": "Quer decidir depois do verão.",
                                        "valor_estimado": 4200,
                                        "motivo_perda": null,
                                        "motivo_perda_rotulo": null,
                                        "proxima_acao": "Ligar para marcar consulta",
                                        "proxima_acao_em": "2026-10-29T10:00:00+00:00",
                                        "sla_ate": null,
                                        "sla_atrasado": false,
                                        "primeira_resposta_em": "2026-10-28T09:12:00+00:00",
                                        "ultimo_contacto_em": "2026-10-28T09:12:00+00:00",
                                        "paciente_id": null,
                                        "convertido_em": null,
                                        "recomendado_por": null,
                                        "recompensa_estado": null,
                                        "consentimento_contacto": true,
                                        "marketing": {
                                            "decisao": "dado",
                                            "valido": true,
                                            "adesao_confirmada_em": "2026-10-28T09:30:00+00:00"
                                        },
                                        "notas": null,
                                        "criado_em": "2026-10-28T08:47:00+00:00",
                                        "conversas": [
                                            {
                                                "id": 301,
                                                "canal": "whatsapp",
                                                "canal_rotulo": "WhatsApp",
                                                "estado": "aberta",
                                                "estado_rotulo": "Aberta",
                                                "aguarda_resposta": false,
                                                "ultima_mensagem_em": "2026-10-28T09:12:00+00:00"
                                            }
                                        ],
                                        "chamadas": [],
                                        "cronologia": [
                                            {
                                                "titulo": "Lead criado (Meta (anúncios))",
                                                "descricao": null,
                                                "categoria": "comercial",
                                                "tipo": "lead_criado",
                                                "data": "2026-10-28T08:47:00+00:00"
                                            }
                                        ],
                                        "duplicados": [],
                                        "fases": [
                                            {
                                                "id": 1,
                                                "nome": "Novo",
                                                "tipo": "aberta",
                                                "cor": "#64748b"
                                            },
                                            {
                                                "id": 2,
                                                "nome": "Contactado",
                                                "tipo": "aberta",
                                                "cor": "#3b82f6"
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "id": 14,
                                                "nome": "Sofia Martins"
                                            }
                                        ],
                                        "motivos_perda": [
                                            {
                                                "valor": "preco",
                                                "rotulo": "Preço"
                                            }
                                        ],
                                        "decisoes": [
                                            {
                                                "valor": "confirmado",
                                                "rotulo": "Confirmado"
                                            }
                                        ],
                                        "pode_editar": true,
                                        "pode_valores": true,
                                        "pode_converter": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/crm/leads/{id}": {
            "get": {
                "tags": [
                    "Funil e leads"
                ],
                "operationId": "crmObterLead",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "ver",
                "summary": "Lead detail",
                "description": "Contact data, source, stage, decision, next action, marketing consent, recent conversations and calls, commercial timeline and possible duplicates. «valor_estimado» only with financeiro.valores. Read is audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmLeadDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 812,
                                        "nome": "Ricardo Almeida",
                                        "email": "ricardo.almeida@exemplo.pt",
                                        "telefone": "+351912345678",
                                        "tel": "tel:+351912345678",
                                        "data_nascimento": null,
                                        "idioma": "pt-PT",
                                        "origem": "meta",
                                        "origem_rotulo": "Meta (anúncios)",
                                        "campanha": "capilar-outono",
                                        "utm": {
                                            "source": "facebook",
                                            "medium": "cpc",
                                            "campaign": "capilar-outono"
                                        },
                                        "procedimento": {
                                            "id": 3,
                                            "nome": "Transplante capilar FUE"
                                        },
                                        "fase": {
                                            "id": 2,
                                            "nome": "Contactado",
                                            "tipo": "aberta",
                                            "cor": "#3b82f6"
                                        },
                                        "responsavel": {
                                            "id": 14,
                                            "nome": "Sofia Martins",
                                            "cor": "#8b5cf6"
                                        },
                                        "pontuacao": 55,
                                        "decisao": "indeciso",
                                        "decisao_rotulo": "Indeciso",
                                        "motivo_indecisao": "Quer decidir depois do verão.",
                                        "valor_estimado": 4200,
                                        "motivo_perda": null,
                                        "motivo_perda_rotulo": null,
                                        "proxima_acao": "Ligar para marcar consulta",
                                        "proxima_acao_em": "2026-10-29T10:00:00+00:00",
                                        "sla_ate": null,
                                        "sla_atrasado": false,
                                        "primeira_resposta_em": "2026-10-28T09:12:00+00:00",
                                        "ultimo_contacto_em": "2026-10-28T09:12:00+00:00",
                                        "paciente_id": null,
                                        "convertido_em": null,
                                        "recomendado_por": null,
                                        "recompensa_estado": null,
                                        "consentimento_contacto": true,
                                        "marketing": {
                                            "decisao": "dado",
                                            "valido": true,
                                            "adesao_confirmada_em": "2026-10-28T09:30:00+00:00"
                                        },
                                        "notas": null,
                                        "criado_em": "2026-10-28T08:47:00+00:00",
                                        "conversas": [
                                            {
                                                "id": 301,
                                                "canal": "whatsapp",
                                                "canal_rotulo": "WhatsApp",
                                                "estado": "aberta",
                                                "estado_rotulo": "Aberta",
                                                "aguarda_resposta": false,
                                                "ultima_mensagem_em": "2026-10-28T09:12:00+00:00"
                                            }
                                        ],
                                        "chamadas": [],
                                        "cronologia": [
                                            {
                                                "titulo": "Lead criado (Meta (anúncios))",
                                                "descricao": null,
                                                "categoria": "comercial",
                                                "tipo": "lead_criado",
                                                "data": "2026-10-28T08:47:00+00:00"
                                            }
                                        ],
                                        "duplicados": [],
                                        "fases": [
                                            {
                                                "id": 1,
                                                "nome": "Novo",
                                                "tipo": "aberta",
                                                "cor": "#64748b"
                                            },
                                            {
                                                "id": 2,
                                                "nome": "Contactado",
                                                "tipo": "aberta",
                                                "cor": "#3b82f6"
                                            }
                                        ],
                                        "equipa": [
                                            {
                                                "id": 14,
                                                "nome": "Sofia Martins"
                                            }
                                        ],
                                        "motivos_perda": [
                                            {
                                                "valor": "preco",
                                                "rotulo": "Preço"
                                            }
                                        ],
                                        "decisoes": [
                                            {
                                                "valor": "confirmado",
                                                "rotulo": "Confirmado"
                                            }
                                        ],
                                        "pode_editar": true,
                                        "pode_valores": true,
                                        "pode_converter": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/crm/leads/{id}/atribuir": {
            "post": {
                "tags": [
                    "Funil e leads"
                ],
                "operationId": "crmAtribuirLead",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "summary": "Assign owner",
                "description": "Null removes the owner. The person must belong to the clinic. Effects: notification to the person, audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "responsavel_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "responsavel_id": 14
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmLeadDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/leads/{id}/converter": {
            "post": {
                "tags": [
                    "Funil e leads"
                ],
                "operationId": "crmConverterLead",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "summary": "Convert to patient",
                "description": "Creates the patient from the lead data (or uses the linked patient) and opens the episode. Idempotent: repeating returns the same patient. 409 if the lead was anonymised or the clinical record is unavailable. Effects: sequences stop, timeline, audit and lead.convertido webhook.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "lead_id": {
                                                    "type": "integer"
                                                },
                                                "paciente_id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "lead_id": 812,
                                        "paciente_id": 1204
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    }
                }
            }
        },
        "/crm/leads/{id}/decisao": {
            "post": {
                "tags": [
                    "Funil e leads"
                ],
                "operationId": "crmDecisaoLead",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "summary": "Record the contact's decision",
                "description": "Undecided and declined require a reason. The estimated value is only accepted from users who can see values. Recalculates the score. Effects: timeline, audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "por_decidir",
                                            "confirmado",
                                            "indeciso",
                                            "recusado"
                                        ]
                                    },
                                    "motivo_indecisao": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "valor_estimado": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "x-unidade": "EUR"
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "indeciso",
                                "motivo_indecisao": "Quer decidir depois do verão.",
                                "valor_estimado": 4200
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmLeadDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/leads/{id}/duplicados": {
            "get": {
                "tags": [
                    "Funil e leads"
                ],
                "operationId": "crmDuplicadosLead",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "ver",
                "summary": "Possible duplicates",
                "description": "Leads with the same phone, email, tax number or name and birth date. «forte» = phone or email.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/CrmDuplicado"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "tipo": "lead",
                                            "id": 790,
                                            "nome": "Ricardo Almeida",
                                            "motivos": [
                                                "email"
                                            ],
                                            "forte": true,
                                            "convertido": false,
                                            "perdido": true
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/leads/{id}/fase": {
            "post": {
                "tags": [
                    "Funil e leads"
                ],
                "operationId": "crmMudarFaseLead",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "summary": "Change stage",
                "description": "Moves the lead (with its position in the column). For a «lost» stage the loss reason is required (422 without it). Effects: timeline, stage automatic tasks, sequence enrolment/stop, pending referral reward when won, audit and lead.fase_alterada webhook.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "fase_id": {
                                        "type": "integer"
                                    },
                                    "ordem": {
                                        "type": "integer",
                                        "minimum": 0
                                    },
                                    "motivo_perda": {
                                        "type": "string",
                                        "enum": [
                                            "preco",
                                            "prazo",
                                            "concorrencia",
                                            "nao_elegivel",
                                            "sem_resposta",
                                            "outro"
                                        ]
                                    },
                                    "motivo_perda_detalhe": {
                                        "type": "string",
                                        "maxLength": 255
                                    }
                                },
                                "required": [
                                    "fase_id"
                                ]
                            },
                            "example": {
                                "fase_id": 9,
                                "ordem": 0,
                                "motivo_perda": "preco",
                                "motivo_perda_detalhe": "Escolheu uma clínica no estrangeiro."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmLeadDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/leads/{id}/fundir": {
            "post": {
                "tags": [
                    "Funil e leads"
                ],
                "operationId": "crmFundirLead",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "summary": "Merge a duplicate lead into this one",
                "description": "Conversations, calls, tasks, agent requests and timeline move to the lead in the path; the duplicate is marked as merged. Effects: timeline, audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "duplicado_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "duplicado_id"
                                ]
                            },
                            "example": {
                                "duplicado_id": 790
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmLeadDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/leads/{id}/proxima-acao": {
            "post": {
                "tags": [
                    "Funil e leads"
                ],
                "operationId": "crmProximaAcaoLead",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "summary": "Set the next action",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "proxima_acao": {
                                        "type": "string",
                                        "maxLength": 190
                                    },
                                    "proxima_acao_em": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time"
                                    }
                                }
                            },
                            "example": {
                                "proxima_acao": "Ligar para marcar consulta",
                                "proxima_acao_em": "2026-10-29T10:00:00+00:00"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmLeadDetalhe"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/marcador": {
            "get": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmMarcador",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "ver",
                "summary": "Call lists and statistics",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Statistics period start (30 days by default)."
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Period end."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "listas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/CrmListaChamadas"
                                                    }
                                                },
                                                "estatisticas": {
                                                    "$ref": "#/components/schemas/CrmEstatisticasChamadas"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "listas": [
                                            {
                                                "id": 12,
                                                "nome": "Reativação outono",
                                                "tipo": "reativacao",
                                                "tipo_rotulo": "Reativação",
                                                "finalidade": "comercial",
                                                "estado": "ativa",
                                                "estado_rotulo": "Ativa",
                                                "total": 140,
                                                "concluidos": 38,
                                                "bloqueados": 22,
                                                "guiao_id": 4
                                            }
                                        ],
                                        "estatisticas": {
                                            "de": "2026-09-28",
                                            "ate": "2026-10-28",
                                            "totais": {
                                                "atendidas": 412,
                                                "perdidas": 37,
                                                "fora_horas": 51,
                                                "saida": 260,
                                                "por_devolver": 3
                                            },
                                            "por_pessoa": [],
                                            "calor": [
                                                {
                                                    "x": "10h",
                                                    "serie": "Seg",
                                                    "y": 14
                                                }
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/crm/marcador/contactos/{id}/resultado": {
            "post": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmResultadoChamada",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "summary": "Record the call outcome",
                "description": "When the person answered and the list has a script, requires the opening confirmation (identification and purpose) and the script's required fields. «ligar_mais_tarde» requires reagendar_em; «nao_atendeu» goes back to the queue up to the attempt limit; «pediu_nao_contactar» adds the number to the opt-out list and revokes marketing consent; «marcou_consulta» moves the lead to the booked-consultation stage. Effects: call updated, timeline, audit; the list finishes when no contacts remain.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "resultado": {
                                        "type": "string",
                                        "enum": [
                                            "marcou_consulta",
                                            "interessado",
                                            "ligar_mais_tarde",
                                            "sem_interesse",
                                            "nao_atendeu",
                                            "numero_errado",
                                            "pediu_nao_contactar",
                                            "confirmou",
                                            "remarcou",
                                            "cancelou"
                                        ]
                                    },
                                    "abertura_feita": {
                                        "type": "boolean"
                                    },
                                    "respostas": {
                                        "type": "object",
                                        "additionalProperties": true,
                                        "description": "Script field key → value."
                                    },
                                    "notas": {
                                        "type": "string",
                                        "maxLength": 4000
                                    },
                                    "reagendar_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "duracao_s": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "x-unidade": "s"
                                    }
                                },
                                "required": [
                                    "resultado"
                                ]
                            },
                            "example": {
                                "resultado": "marcou_consulta",
                                "abertura_feita": true,
                                "respostas": {
                                    "data_preferida": "2026-11-05",
                                    "financiamento": "nao"
                                },
                                "notas": "Prefere manhãs.",
                                "duracao_s": 184
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmContactoMarcador"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 4410,
                                        "campanha_id": 12,
                                        "nome": "Helena Duarte",
                                        "telefone": "+351936000111",
                                        "paciente_id": 702,
                                        "lead_id": null,
                                        "estado": "concluido",
                                        "estado_rotulo": "Concluído",
                                        "resultado": "marcou_consulta",
                                        "resultado_rotulo": "Marcou consulta",
                                        "motivo_bloqueio": null,
                                        "tentativas": 1,
                                        "proxima_tentativa_em": null,
                                        "respostas": [],
                                        "notas": null,
                                        "finalidade": "comercial",
                                        "tel": "tel:+351936000111"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/marcador/ligar": {
            "post": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmLigar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "summary": "Call (click to call)",
                "description": "Records the outbound call. If the clinic configured the PBX address, it asks the PBX to call (fornecedor = true); otherwise returns the tel: address for the device phone. Blocks (422) commercial calls without consent or to opted-out numbers. Limit: 120 per minute.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "numero": {
                                        "type": "string",
                                        "maxLength": 30
                                    },
                                    "contacto_id": {
                                        "type": "integer"
                                    },
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "lead_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "numero"
                                ]
                            },
                            "example": {
                                "numero": "+351936000111",
                                "contacto_id": 4410
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "tel": {
                                                    "type": "string"
                                                },
                                                "fornecedor": {
                                                    "type": "boolean",
                                                    "description": "true when the clinic PBX placed the call; false → open the tel: address on the device."
                                                },
                                                "chamada_id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "tel": "tel:+351936000111",
                                        "fornecedor": false,
                                        "chamada_id": 30551
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/crm/marcador/{id}": {
            "get": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmListaChamadas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "ver",
                "summary": "List with script and contacts",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/CrmListaChamadas"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "guiao": {
                                                            "$ref": "#/components/schemas/CrmGuiao"
                                                        },
                                                        "contactos": {
                                                            "type": "array",
                                                            "items": {
                                                                "$ref": "#/components/schemas/CrmContactoMarcador"
                                                            }
                                                        },
                                                        "resultados": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "valor": {
                                                                        "type": "string"
                                                                    },
                                                                    "rotulo": {
                                                                        "type": "string"
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/marcador/{id}/estado": {
            "post": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmEstadoLista",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "summary": "Activate, pause or finish the list",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "ativa",
                                            "pausada",
                                            "concluida"
                                        ]
                                    }
                                },
                                "required": [
                                    "estado"
                                ]
                            },
                            "example": {
                                "estado": "pausada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "estado": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 12,
                                        "estado": "pausada"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/marcador/{id}/gerar": {
            "post": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmGerarLista",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "summary": "Generate the list contacts",
                "description": "Applies the list filter (reactivation, confirmations, stalled proposals, post-op or stage leads). In commercial lists it blocks contacts without marketing consent or customer exception and those on the opt-out list (motivo_bloqueio). A draft list becomes active.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "bloqueados": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "total": 140,
                                        "bloqueados": 22
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/marcador/{id}/seguinte": {
            "get": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmContactoSeguinte",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "summary": "Next contact",
                "description": "Reserves the next pending contact (or rescheduled one whose time has come) for the caller. Re-checks consent: a contact that can no longer be called is blocked and skipped. dados = null when the list is finished.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "oneOf": [
                                                {
                                                    "$ref": "#/components/schemas/CrmContactoMarcador"
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 4410,
                                        "campanha_id": 12,
                                        "nome": "Helena Duarte",
                                        "telefone": "+351936000111",
                                        "paciente_id": 702,
                                        "lead_id": null,
                                        "estado": "em_curso",
                                        "estado_rotulo": "Em curso",
                                        "resultado": null,
                                        "resultado_rotulo": null,
                                        "motivo_bloqueio": null,
                                        "tentativas": 0,
                                        "proxima_tentativa_em": null,
                                        "respostas": [],
                                        "notas": null,
                                        "finalidade": "comercial",
                                        "tel": "tel:+351936000111"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/telefonia/ao-vivo": {
            "get": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmTelefoniaAoVivo",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "ver",
                "summary": "Live calls",
                "description": "Ringing and ongoing calls of the clinic with the contact record (name, owner, open tasks, last contact). «controlo»: the phone system accepts commands.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "instalado": {
                                                    "type": "boolean"
                                                },
                                                "controlo": {
                                                    "type": "boolean"
                                                },
                                                "chamadas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/CrmChamadaAoVivo"
                                                    }
                                                },
                                                "atualizado_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/crm/telefonia/chamadas/{id}/controlo": {
            "post": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmTelefoniaControlo",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "summary": "Answer, transfer or hang up via the phone system",
                "description": "Sends the command to the phone system address (crm.telefonia.controlo_url, https). Answer connects to the personal extension of the requester; transfer accepts utilizador_id, departamento or extensao. 409 without a configured address or outside production; 502 if the phone system refuses. Audited.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "acao": {
                                        "type": "string",
                                        "enum": [
                                            "atender",
                                            "transferir",
                                            "desligar"
                                        ]
                                    },
                                    "utilizador_id": {
                                        "type": "integer"
                                    },
                                    "departamento": {
                                        "type": "string",
                                        "enum": [
                                            "rececao",
                                            "comercial",
                                            "enfermagem",
                                            "medico",
                                            "tecnico",
                                            "administracao"
                                        ]
                                    },
                                    "extensao": {
                                        "type": "string",
                                        "pattern": "^\\+?[0-9*#]{2,20}$"
                                    }
                                },
                                "required": [
                                    "acao"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "acao": {
                                                    "type": "string"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "502": {
                        "description": "The phone system refused the command"
                    }
                }
            }
        },
        "/crm/telefonia/numeros": {
            "get": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmTelefoniaNumeros",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "ver",
                "summary": "Results per clinic number",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Start (default: 30 days)"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "End"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "numero": {
                                                        "type": "string"
                                                    },
                                                    "nome": {
                                                        "type": "string"
                                                    },
                                                    "origem": {
                                                        "type": "string"
                                                    },
                                                    "campanha": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "ativo": {
                                                        "type": "boolean"
                                                    },
                                                    "chamadas": {
                                                        "type": "integer"
                                                    },
                                                    "atendidas": {
                                                        "type": "integer"
                                                    },
                                                    "perdidas": {
                                                        "type": "integer"
                                                    },
                                                    "leads": {
                                                        "type": "integer"
                                                    },
                                                    "convertidos": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/crm/voz/menus/{id}": {
            "get": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmVozMenu",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "ver",
                "summary": "Voice menu for the editor",
                "description": "General data, validated tree, hours, closed days, out-of-hours, holiday, linked numbers, current moment and the editor options (destinations, departments with extension, languages, keys, recorded messages). 503 «por_instalar» before the migration.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmMenuVozEditor"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "put": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmVozMenuGravar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "summary": "Save and publish a voice menu",
                "description": "Saves the whole menu and publishes a new version (the phone system uses it at once). Per-field errors (nos.N.opcoes.M.tecla, inicio…). Only one main menu per clinic. Audited.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string"
                                    },
                                    "descricao": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "ativo": {
                                        "type": "boolean"
                                    },
                                    "predefinido": {
                                        "type": "boolean"
                                    },
                                    "lingua": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    },
                                    "reconhecido": {
                                        "type": "string",
                                        "enum": [
                                            "menu",
                                            "gestor",
                                            "agente"
                                        ]
                                    },
                                    "aviso_gravacao": {
                                        "type": "boolean"
                                    },
                                    "usar_horario_clinica": {
                                        "type": "boolean"
                                    },
                                    "horario": {
                                        "type": "object"
                                    },
                                    "feriados": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "type": "string",
                                                    "format": "date"
                                                },
                                                "nome": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    },
                                    "fora_horas": {
                                        "type": "object"
                                    },
                                    "feriado": {
                                        "type": "object"
                                    },
                                    "arvore": {
                                        "$ref": "#/components/schemas/CrmMenuVozArvore"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmMenuVozEditor"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/voz/menus/{id}/ouvir": {
            "post": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmVozMenuOuvir",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "summary": "Listen to a step message",
                "description": "Synthesised speech of the text (≤ 600 characters, no patient data) in the chosen language, with the same speech service as the calls. 503 «fala_indisponivel» if no speech service answers.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "texto": {
                                        "type": "string"
                                    },
                                    "lingua": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    }
                                },
                                "required": [
                                    "texto"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mime": {
                                                    "type": "string"
                                                },
                                                "formato": {
                                                    "type": "string",
                                                    "enum": [
                                                        "wav",
                                                        "mp3"
                                                    ]
                                                },
                                                "duracao_ms": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "servico": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "base64": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/crm/voz/menus/{id}/simular": {
            "post": {
                "tags": [
                    "Marcador e chamadas"
                ],
                "operationId": "crmVozMenuSimular",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "ver",
                "summary": "Simulate a call in the menu",
                "description": "Runs the inputs in order («1», «#», spoken text or empty = no answer) over the saved menu or the sent tree (not saved yet), with optional moment and caller number. Calls no one and generates no speech.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "entradas": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "telefone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "momento": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "aberto",
                                            "fora_horas",
                                            "feriado",
                                            null
                                        ]
                                    },
                                    "lingua": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    },
                                    "arvore": {
                                        "$ref": "#/components/schemas/CrmMenuVozArvore"
                                    }
                                }
                            },
                            "example": {
                                "entradas": [
                                    "2",
                                    "pós-operatório",
                                    ""
                                ],
                                "momento": "aberto",
                                "lingua": "pt-PT"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "passos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "entrada": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "tipo": {
                                                                "type": "string"
                                                            },
                                                            "tipo_rotulo": {
                                                                "type": "string"
                                                            },
                                                            "no": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "titulo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "texto": {
                                                                "type": "string"
                                                            },
                                                            "gravacao_id": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "teclas": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "destino": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ]
                                                            },
                                                            "destino_rotulo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                },
                                                "fim": {
                                                    "type": "boolean"
                                                },
                                                "lingua": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/crm/voz/vozes": {
            "get": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmVozVozes",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "ver",
                "summary": "Voices per language and variant",
                "description": "For each language: whether the agent speaks it, who listens and who speaks (local, external service or the phone system voice), the configured voice, warnings (Brazilian voice for pt-PT, local service without pt-PT…) and the last test. No model names.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmVozesLinguas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/crm/voz/vozes/testar": {
            "post": {
                "tags": [
                    "Agente de IA"
                ],
                "operationId": "crmVozTestar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "summary": "Test the voice of a language",
                "description": "Speaks a typical sentence of the variant, listens back and compares (similarity, detected language and variant, warnings). The audio comes as base64 to listen to. No patient data. Audited.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "lingua": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    }
                                },
                                "required": [
                                    "lingua"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "lingua": {
                                                    "type": "string"
                                                },
                                                "frase": {
                                                    "type": "string"
                                                },
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "audio": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ]
                                                },
                                                "servico_fala": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "servico_ouvir": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "voz": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "ouvido": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "semelhanca": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "lingua_detetada": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "variante_detetada": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "avisos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "avisos_rotulos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/definicoes": {
            "get": {
                "tags": [
                    "Definições"
                ],
                "operationId": "definicoes",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Settings groups with values",
                "description": "Each field: {chave, tipo, rotulo, ajuda, secao, padrao, opcoes, min, max, obrigatorio, valor, definido}. Secrets are never returned: valor null and definido true|false.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "grupo": {
                                                        "type": "string"
                                                    },
                                                    "titulo": {
                                                        "type": "string"
                                                    },
                                                    "descricao": {
                                                        "type": "string"
                                                    },
                                                    "editavel": {
                                                        "type": "boolean"
                                                    },
                                                    "campos": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object"
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "put": {
                "tags": [
                    "Definições"
                ],
                "operationId": "gravarDefinicoes",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Save settings of one group",
                "description": "An empty secret keeps the value; to clear a secret send limpar:{chave:true}.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "grupo": {
                                        "type": "string"
                                    },
                                    "valores": {
                                        "type": "object",
                                        "additionalProperties": true
                                    },
                                    "limpar": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "boolean"
                                        }
                                    }
                                },
                                "required": [
                                    "grupo",
                                    "valores"
                                ]
                            },
                            "example": {
                                "grupo": "seguranca",
                                "valores": {
                                    "seguranca.sessao_minutos": 30
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/definicoes/email/testar": {
            "post": {
                "tags": [
                    "Definições"
                ],
                "operationId": "testarEmail",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "summary": "Send a test email",
                "description": "«plataforma» requires a superadministrator; «clinica» requires Settings › Edit. Uses the stored data of that server. Failures return ok:false with a category (incompleto, ligacao, autenticacao, cifra, remetente, tempo, outro) and a readable message. Never returns the password. Audited.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "ambito": {
                                        "type": "string",
                                        "enum": [
                                            "plataforma",
                                            "clinica"
                                        ]
                                    },
                                    "para": {
                                        "type": "string",
                                        "format": "email"
                                    }
                                },
                                "required": [
                                    "ambito",
                                    "para"
                                ]
                            },
                            "example": {
                                "ambito": "clinica",
                                "para": "geral@clinicaporto.pt"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoEmailTeste"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "categoria": "ok",
                                        "mensagem": "Email de teste enviado para geral@clinicaporto.pt.",
                                        "servidor": "smtp.clinicaporto.pt",
                                        "porta": 587,
                                        "cifra": "tls",
                                        "remetente": "geral@clinicaporto.pt",
                                        "utilizador": "ge•••@clinicaporto.pt"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/emergencia": {
            "post": {
                "tags": [
                    "Sessão"
                ],
                "operationId": "acessoEmergencia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Request emergency access to a patient",
                "description": "When a request returns 403 with erro.paciente_id, the app may offer this request. Reason required (20 to 1000 characters). Access is temporary (Settings › Security), logged in the audit trail and reviewed by management. Profiles whose data-protection ceiling forbids clinical access cannot request it.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 20,
                                        "maxLength": 1000
                                    }
                                },
                                "required": [
                                    "paciente_id",
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "paciente_id": {
                                                    "type": "integer"
                                                },
                                                "inicio": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "fim": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "estado": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/eu": {
            "get": {
                "tags": [
                    "Sessão"
                ],
                "operationId": "eu",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    },
                    {
                        "integracao": []
                    }
                ],
                "summary": "Who am I (account, clinic, effective permissions, preferences)",
                "description": "Team: account, global, clinics, permissions (module → {nivel, ambito, aprovar, exportar}), active modules, emergencies, preferences. Patient: account and preferences. Integration: client and scope permissions.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/eu/clinica": {
            "post": {
                "tags": [
                    "Sessão"
                ],
                "operationId": "mudarClinica",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Switch clinic (global users only)",
                "description": "The choice is bound to the app session; alternatively send X-AX-Clinica on each request.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "clinica_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "clinica_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "clinica_id": {
                                                    "type": "integer"
                                                },
                                                "nome": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/execucoes/cirurgias/{cirurgia_id}": {
            "get": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "execucaoDaCirurgia",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.registo:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "cirurgia_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "ver",
                "summary": "Day 0 areas and implanted per zone",
                "description": "Created from the approved plan on first read. View: bloco.registo or ficha.plano.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Execucao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/execucoes/{id}/areas": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "confirmarAreasDia0",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Confirm the day 0 areas",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "zonas": {
                                        "type": "array",
                                        "items": {
                                            "type": "object"
                                        }
                                    },
                                    "captura_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "zonas"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Execucao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/execucoes/{id}/areas/calcular": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "calcularAreasDia0",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.registo:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "ver",
                "summary": "Recalculate with the day 0 areas (without saving)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "zonas": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "zona": {
                                                    "type": "string"
                                                },
                                                "area_cm2": {
                                                    "oneOf": [
                                                        {
                                                            "type": "number"
                                                        },
                                                        {
                                                            "$ref": "#/components/schemas/ValorComUnidade"
                                                        },
                                                        {
                                                            "type": "null"
                                                        }
                                                    ]
                                                },
                                                "origem_area": {
                                                    "type": "string",
                                                    "enum": [
                                                        "manual",
                                                        "modelo3d",
                                                        "diagrama"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "zonas"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Execucao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/execucoes/{id}/implantados": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "implantadosPorZona",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.registo:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "summary": "Record implanted grafts per zone",
                "description": "With planeamento.dia0_confirmar_antes, requires the confirmed areas.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "zonas": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "zona": {
                                                    "type": "string"
                                                },
                                                "enxertos_implantados": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    },
                                    "notas": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "zonas"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Execucao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/execucoes/{id}/real": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "atualizarRealExecucao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.registo:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "ver",
                "summary": "Re-read the panel counts (actual hairs per graft)",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Execucao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/exportacoes": {
            "get": {
                "tags": [
                    "Exportação"
                ],
                "operationId": "listarExportacoesTotais",
                "summary": "Full clinic exports",
                "description": "State of each request (pedido, a_gerar, concluida, erro, expirada), size, tables, SHA-256 and a 15-minute signed link to download in the browser.",
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Exportacao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "tags": [
                    "Exportação"
                ],
                "operationId": "pedirExportacaoTotal",
                "summary": "Request a full export",
                "description": "ZIP with one CSV per clinic table, manifest (tables, columns, rows, SHA-256) and file list. Credentials and secrets are never exported; encrypted fields stay encrypted. Generated in the background; one request at a time.\n\nEffects: audit (with reason); notification to the requester and webhook exportacao.concluida when ready.",
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "motivo"
                                ],
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 5,
                                        "maxLength": 255
                                    }
                                }
                            },
                            "example": {
                                "motivo": "Cópia anual para arquivo"
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Accepted for processing",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "estado": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 4,
                                        "estado": "pedido"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ficheiros": {
            "post": {
                "tags": [
                    "Ficheiros"
                ],
                "operationId": "carregarFicheiro",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Upload a file",
                "description": "Real type checked from the content; name replaced by a random one; images stripped of location metadata; clinical files encrypted at rest. Limits in Settings › Security.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "categoria": {
                                        "type": "string"
                                    },
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "clinico": {
                                        "type": "integer",
                                        "enum": [
                                            0,
                                            1
                                        ]
                                    },
                                    "modulo": {
                                        "type": "string"
                                    },
                                    "dono_tipo": {
                                        "type": "string"
                                    },
                                    "dono_id": {
                                        "type": "integer"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "paciente_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "categoria": {
                                                    "type": "string"
                                                },
                                                "nome_original": {
                                                    "type": "string"
                                                },
                                                "mime": {
                                                    "type": "string"
                                                },
                                                "tipo_logico": {
                                                    "type": "string"
                                                },
                                                "tamanho": {
                                                    "type": "integer"
                                                },
                                                "sha256": {
                                                    "type": "string"
                                                },
                                                "largura": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "altura": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "clinico": {
                                                    "type": "boolean"
                                                },
                                                "origem": {
                                                    "type": "string"
                                                },
                                                "criado_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "url": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/ficheiros/{id}/url": {
            "get": {
                "tags": [
                    "Ficheiros"
                ],
                "operationId": "urlFicheiro",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Signed link (15 minutes)",
                "description": "The link re-checks the requester permissions when opened.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "descarregar",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "url": {
                                                    "type": "string"
                                                },
                                                "expira_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "mime": {
                                                    "type": "string"
                                                },
                                                "nome": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/formularios/biblioteca": {
            "get": {
                "tags": [
                    "Formulários"
                ],
                "operationId": "m1BibliotecaFormularios",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "Ready-to-adapt templates",
                "description": "Forms flagged as templates (up to 200), by type and name, with the number of questions and steps. To use one, duplicate it (POST /formularios/{id}/duplicar). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "allOf": [
                                                    {
                                                        "$ref": "#/components/schemas/M1Formulario"
                                                    },
                                                    {
                                                        "type": "object",
                                                        "properties": {
                                                            "perguntas": {
                                                                "type": "integer"
                                                            },
                                                            "passos": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    }
                                                ]
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 3,
                                            "chave": "questionario_previo",
                                            "nome": "Questionário prévio",
                                            "descricao": "A preencher antes da primeira consulta.",
                                            "tipo": "questionario_previo",
                                            "tipo_rotulo": "Questionário prévio",
                                            "tecnica": null,
                                            "versao": 1,
                                            "idioma": "pt-PT",
                                            "ativo": true,
                                            "modelo": true,
                                            "expira_dias": 14,
                                            "publicado_em": "2026-10-20T15:40:00+01:00",
                                            "perguntas": 24,
                                            "passos": 4
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/formularios/ficheiro": {
            "post": {
                "tags": [
                    "Formulários"
                ],
                "operationId": "m1FicheiroFormularioEquipa",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Upload the photo of a question (team)",
                "description": "Same as POST equipa/formularios/ficheiro on the web. Images only, up to 15 MB: real type checked from the bytes, executable extensions refused, random name, stored outside the public area as a clinical file of the patient. No photo is collected before the «fotografias_clinicas» authorisation: already recorded for the patient or declared now with consentimento_fotos = 1 (otherwise 422 on «ficheiro»). A given patient must exist (422) and be in clinical scope (403). Returns the identifier to use in the question answer. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After). Additional limit: 60 requests per 10 minutes per IP address (only data-changing requests count).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "Image up to 15 MB"
                                    },
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "consentimento_fotos": {
                                        "type": "string",
                                        "enum": [
                                            "0",
                                            "1"
                                        ],
                                        "description": "1 when the photo authorisation was declared in this fill-in."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "nome": {
                                                    "type": "string"
                                                },
                                                "nome_original": {
                                                    "type": "string"
                                                },
                                                "url": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 9051,
                                        "nome": "frontal.jpg",
                                        "nome_original": "frontal.jpg",
                                        "url": "https://clinica.exemplo.pt/ficheiros/9051?assinatura=…"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/formularios/respostas/{id}": {
            "get": {
                "tags": [
                    "Formulários"
                ],
                "operationId": "m1ObterRespostaFormulario",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "Readable response",
                "description": "Team and integrations. Response with its version schema, the values, the formatted items (question, section, readable text, alarm), source, status, score and band, who validated and the return information request. A patient response requires the patient in clinical scope. Read is audited («ver», formularios_respostas). Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per team token; integrations use the per-minute limit set on the integration client (429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Response identifier (formularios_respostas)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1RespostaFormulario"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/formularios/{id}/duplicar": {
            "post": {
                "tags": [
                    "Formulários"
                ],
                "operationId": "m1DuplicarFormulario",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Form identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Editable copy",
                "description": "Creates a new form (version 1, inactive, not a template) with the original schema, type, technique, language and deadline; new key derived from the original; given name or «Cópia de …» (up to 160). Effects: version copy, «criar» audit. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 160
                                    }
                                }
                            },
                            "example": {
                                "nome": "Questionário prévio — FUE"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1Formulario"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 32,
                                        "chave": "questionario_previo_c482913",
                                        "nome": "Questionário prévio — FUE",
                                        "descricao": "A preencher antes da primeira consulta.",
                                        "tipo": "questionario_previo",
                                        "tipo_rotulo": "Questionário prévio",
                                        "tecnica": "FUE",
                                        "versao": 1,
                                        "idioma": "pt-PT",
                                        "ativo": false,
                                        "modelo": false,
                                        "expira_dias": 14,
                                        "publicado_em": "2026-10-20T15:40:00+01:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/formularios/{id}/editor": {
            "get": {
                "tags": [
                    "Formulários"
                ],
                "operationId": "m1EditorFormulario",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "Form for the builder",
                "description": "Form, current schema, catalogue of the 12 question types, published versions (up to 50), translations (same key in other languages), number of responses received, whether the caller may edit and whether translation by the clinic's AI assistant is configured. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Form identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1EditorFormulario"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/formularios/{id}/esquema": {
            "put": {
                "tags": [
                    "Formulários"
                ],
                "operationId": "m1GravarEsquemaFormulario",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Save the schema (new version if there are responses)",
                "description": "Validates and normalises the schema: 1 to 20 steps, up to 300 questions, types from the closed list, unique keys in a-z0-9_ format, options and columns in their own format, conditions only for existing questions (others are dropped), up to 10 score bands; per-question errors → 422 with «pergunta_N». If the current version already has responses, a new version is published (old responses stay tied to their version schema). Also accepts nome (up to 160), descricao (up to 400), expira_dias (1–365; 0 or empty = settings deadline) and ativo. Effects: version copy, «alterar» audit. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Form identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "esquema": {
                                        "$ref": "#/components/schemas/M1EsquemaFormulario"
                                    },
                                    "nome": {
                                        "type": "string",
                                        "maxLength": 160
                                    },
                                    "descricao": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 400
                                    },
                                    "expira_dias": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 365
                                    },
                                    "ativo": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "esquema"
                                ]
                            },
                            "example": {
                                "esquema": {
                                    "passos": [
                                        {
                                            "chave": "p1",
                                            "titulo": "Saúde geral",
                                            "descricao": "",
                                            "seccoes": [
                                                {
                                                    "chave": "s1_1",
                                                    "titulo": "Antecedentes",
                                                    "descricao": "",
                                                    "perguntas": [
                                                        {
                                                            "chave": "anticoagulantes",
                                                            "tipo": "simnao",
                                                            "rotulo": "Toma anticoagulantes?",
                                                            "ajuda": "",
                                                            "obrigatorio": true,
                                                            "preencher": true,
                                                            "pontos_sim": null,
                                                            "alarme_sim": true,
                                                            "alerta": {
                                                                "tipo": "anticoagulante",
                                                                "gravidade": "alta",
                                                                "quando": [
                                                                    "sim"
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "chave": "qual_anticoagulante",
                                                            "tipo": "texto",
                                                            "rotulo": "Qual?",
                                                            "ajuda": "",
                                                            "obrigatorio": false,
                                                            "preencher": true,
                                                            "max": 200,
                                                            "condicao": {
                                                                "pergunta": "anticoagulantes",
                                                                "operador": "=",
                                                                "valor": "sim"
                                                            }
                                                        },
                                                        {
                                                            "chave": "impacto",
                                                            "tipo": "escala",
                                                            "rotulo": "Quanto o incomoda a queda de cabelo?",
                                                            "ajuda": "",
                                                            "obrigatorio": true,
                                                            "preencher": false,
                                                            "min": 0,
                                                            "max": 10,
                                                            "passo": 1,
                                                            "rotulo_min": "Nada",
                                                            "rotulo_max": "Muito",
                                                            "pontuar": true,
                                                            "alarme_min": null
                                                        }
                                                    ]
                                                }
                                            ]
                                        }
                                    ],
                                    "pontuacao": {
                                        "ativa": true,
                                        "rotulo": "Impacto",
                                        "modo": "soma",
                                        "pergunta": null,
                                        "faixas": [
                                            {
                                                "min": 0,
                                                "max": 4,
                                                "rotulo": "Baixo",
                                                "tom": "sucesso"
                                            },
                                            {
                                                "min": 5,
                                                "max": 10,
                                                "rotulo": "Elevado",
                                                "tom": "aviso"
                                            }
                                        ]
                                    },
                                    "alarmes": {
                                        "departamento": "enfermagem"
                                    }
                                },
                                "nome": "Questionário prévio — FUE",
                                "expira_dias": 14,
                                "ativo": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "formulario": {
                                                    "$ref": "#/components/schemas/M1Formulario"
                                                },
                                                "esquema": {
                                                    "$ref": "#/components/schemas/M1EsquemaFormulario"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "formulario": {
                                            "id": 31,
                                            "chave": "questionario_previo_fue",
                                            "nome": "Questionário prévio — FUE",
                                            "descricao": "A preencher antes da primeira consulta.",
                                            "tipo": "questionario_previo",
                                            "tipo_rotulo": "Questionário prévio",
                                            "tecnica": "FUE",
                                            "versao": 4,
                                            "idioma": "pt-PT",
                                            "ativo": true,
                                            "modelo": false,
                                            "expira_dias": 14,
                                            "publicado_em": "2026-10-20T15:40:00+01:00"
                                        },
                                        "esquema": {
                                            "passos": [
                                                {
                                                    "chave": "p1",
                                                    "titulo": "Saúde geral",
                                                    "descricao": "",
                                                    "seccoes": [
                                                        {
                                                            "chave": "s1_1",
                                                            "titulo": "Antecedentes",
                                                            "descricao": "",
                                                            "perguntas": [
                                                                {
                                                                    "chave": "anticoagulantes",
                                                                    "tipo": "simnao",
                                                                    "rotulo": "Toma anticoagulantes?",
                                                                    "ajuda": "",
                                                                    "obrigatorio": true,
                                                                    "preencher": true,
                                                                    "pontos_sim": null,
                                                                    "alarme_sim": true,
                                                                    "alerta": {
                                                                        "tipo": "anticoagulante",
                                                                        "gravidade": "alta",
                                                                        "quando": [
                                                                            "sim"
                                                                        ]
                                                                    }
                                                                },
                                                                {
                                                                    "chave": "qual_anticoagulante",
                                                                    "tipo": "texto",
                                                                    "rotulo": "Qual?",
                                                                    "ajuda": "",
                                                                    "obrigatorio": false,
                                                                    "preencher": true,
                                                                    "max": 200,
                                                                    "condicao": {
                                                                        "pergunta": "anticoagulantes",
                                                                        "operador": "=",
                                                                        "valor": "sim"
                                                                    }
                                                                },
                                                                {
                                                                    "chave": "impacto",
                                                                    "tipo": "escala",
                                                                    "rotulo": "Quanto o incomoda a queda de cabelo?",
                                                                    "ajuda": "",
                                                                    "obrigatorio": true,
                                                                    "preencher": false,
                                                                    "min": 0,
                                                                    "max": 10,
                                                                    "passo": 1,
                                                                    "rotulo_min": "Nada",
                                                                    "rotulo_max": "Muito",
                                                                    "pontuar": true,
                                                                    "alarme_min": null
                                                                }
                                                            ]
                                                        }
                                                    ]
                                                }
                                            ],
                                            "pontuacao": {
                                                "ativa": true,
                                                "rotulo": "Impacto",
                                                "modo": "soma",
                                                "pergunta": null,
                                                "faixas": [
                                                    {
                                                        "min": 0,
                                                        "max": 4,
                                                        "rotulo": "Baixo",
                                                        "tom": "sucesso"
                                                    },
                                                    {
                                                        "min": 5,
                                                        "max": 10,
                                                        "rotulo": "Elevado",
                                                        "tom": "aviso"
                                                    }
                                                ]
                                            },
                                            "alarmes": {
                                                "departamento": "enfermagem"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/formularios/{id}/pedidos": {
            "post": {
                "tags": [
                    "Formulários"
                ],
                "operationId": "m1PedirFormulario",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Form identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "summary": "Fill-in request by link",
                "description": "The route has no permission of its own: the controller requires «edit» on ficha.identificacao (reception) OR on ficha.clinica — requesting a form shows no clinical content. Team and integrations. Recipient: paciente_id (must be in identification scope, 403) or lead_id. Active forms only (missing or inactive → 422). Creates the «pendente» request with a 32-byte token (only its SHA-256 is stored) and the form or settings deadline (1 to 365 days). Channel email, sms or whatsapp sends the service message with only the questionnaire name, the link and the deadline; «ligacao» and «portal» send no message. The returned link is the web page; the token (last segment) also serves GET /publico/formularios/{token}. expira_em comes in ISO 8601 (e.g. «2026-11-12T09:40:00+00:00»). Effects: timeline (with patient), «enviar» audit. Limit (default): 120 requests per minute per team token; integrations use the per-minute limit set on the integration client (429 with Retry-After). Additional limit: 60 requests per 10 minutes per IP address (only data-changing requests count).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "lead_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "marco_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "consulta_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "email",
                                            "sms",
                                            "whatsapp",
                                            "ligacao",
                                            "portal"
                                        ],
                                        "default": "ligacao"
                                    }
                                }
                            },
                            "example": {
                                "paciente_id": 1204,
                                "episodio_id": 77,
                                "canal": "email"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1PedidoFormulario"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "resposta_id": 5130,
                                        "ligacao": "https://clinica.exemplo.pt/formulario/q3V9k1sXw7bE2mN4tR8yU0pL6aZ5cH1dF9gJ3kM2nB4",
                                        "expira_em": "2026-11-12T09:40:00+00:00",
                                        "envio": {
                                            "ok": true,
                                            "estado": "enviada",
                                            "motivo": null,
                                            "mensagem_id": 66102
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/formularios/{id}/preencher": {
            "get": {
                "tags": [
                    "Formulários"
                ],
                "operationId": "m1PreencherFormulario",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Schema and pre-fill for the team",
                "description": "Form, current schema and pre-fill values: the patient previous responses (awaiting validation or validated) to the same form — same key, any language; questions with «preencher» off, photos and signatures are left out. With paciente_id the patient must exist (422) and be in clinical scope (403). With episodio_id the episode must belong to that patient (422 on «episodio_id») and the most recent response of that episode takes priority in the pre-fill. Compatible additions: «consentimentos» (authorisations the patient has not given yet: the team declares them when collected in person; without them the submission is refused with 422), «episodio_id» and «episodio». Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Form identifier"
                    },
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient (to pre-fill)"
                    },
                    {
                        "name": "episodio_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient episode (priority in the pre-fill)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "formulario": {
                                                    "$ref": "#/components/schemas/M1Formulario"
                                                },
                                                "esquema": {
                                                    "$ref": "#/components/schemas/M1EsquemaFormulario"
                                                },
                                                "valores": {
                                                    "type": "object",
                                                    "additionalProperties": true,
                                                    "description": "Question key → value."
                                                },
                                                "paciente_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "episodio_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "episodio": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "numero": {
                                                            "type": "string"
                                                        },
                                                        "titulo": {
                                                            "type": "string"
                                                        },
                                                        "estado": {
                                                            "type": "string"
                                                        },
                                                        "estado_rotulo": {
                                                            "type": "string"
                                                        }
                                                    }
                                                },
                                                "consentimentos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/M1Consentimento"
                                                    }
                                                },
                                                "aviso": {
                                                    "oneOf": [
                                                        {
                                                            "$ref": "#/components/schemas/M1AvisoPrivacidade"
                                                        },
                                                        {
                                                            "type": "null"
                                                        }
                                                    ],
                                                    "description": "Compatible addition: notice in force for the «formulario» channel to show the patient in person (with paciente_id); return the token in «aviso_testemunho»."
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "formulario": {
                                            "id": 31,
                                            "chave": "questionario_previo_fue",
                                            "nome": "Questionário prévio — FUE",
                                            "descricao": "A preencher antes da primeira consulta.",
                                            "tipo": "questionario_previo",
                                            "tipo_rotulo": "Questionário prévio",
                                            "tecnica": "FUE",
                                            "versao": 3,
                                            "idioma": "pt-PT",
                                            "ativo": true,
                                            "modelo": false,
                                            "expira_dias": 14,
                                            "publicado_em": "2026-10-20T15:40:00+01:00"
                                        },
                                        "esquema": {
                                            "passos": [
                                                {
                                                    "chave": "p1",
                                                    "titulo": "Saúde geral",
                                                    "descricao": "",
                                                    "seccoes": [
                                                        {
                                                            "chave": "s1_1",
                                                            "titulo": "Antecedentes",
                                                            "descricao": "",
                                                            "perguntas": [
                                                                {
                                                                    "chave": "anticoagulantes",
                                                                    "tipo": "simnao",
                                                                    "rotulo": "Toma anticoagulantes?",
                                                                    "ajuda": "",
                                                                    "obrigatorio": true,
                                                                    "preencher": true,
                                                                    "pontos_sim": null,
                                                                    "alarme_sim": true,
                                                                    "alerta": {
                                                                        "tipo": "anticoagulante",
                                                                        "gravidade": "alta",
                                                                        "quando": [
                                                                            "sim"
                                                                        ]
                                                                    }
                                                                },
                                                                {
                                                                    "chave": "qual_anticoagulante",
                                                                    "tipo": "texto",
                                                                    "rotulo": "Qual?",
                                                                    "ajuda": "",
                                                                    "obrigatorio": false,
                                                                    "preencher": true,
                                                                    "max": 200,
                                                                    "condicao": {
                                                                        "pergunta": "anticoagulantes",
                                                                        "operador": "=",
                                                                        "valor": "sim"
                                                                    }
                                                                },
                                                                {
                                                                    "chave": "impacto",
                                                                    "tipo": "escala",
                                                                    "rotulo": "Quanto o incomoda a queda de cabelo?",
                                                                    "ajuda": "",
                                                                    "obrigatorio": true,
                                                                    "preencher": false,
                                                                    "min": 0,
                                                                    "max": 10,
                                                                    "passo": 1,
                                                                    "rotulo_min": "Nada",
                                                                    "rotulo_max": "Muito",
                                                                    "pontuar": true,
                                                                    "alarme_min": null
                                                                }
                                                            ]
                                                        }
                                                    ]
                                                }
                                            ],
                                            "pontuacao": {
                                                "ativa": true,
                                                "rotulo": "Impacto",
                                                "modo": "soma",
                                                "pergunta": null,
                                                "faixas": [
                                                    {
                                                        "min": 0,
                                                        "max": 4,
                                                        "rotulo": "Baixo",
                                                        "tom": "sucesso"
                                                    },
                                                    {
                                                        "min": 5,
                                                        "max": 10,
                                                        "rotulo": "Elevado",
                                                        "tom": "aviso"
                                                    }
                                                ]
                                            },
                                            "alarmes": {
                                                "departamento": "enfermagem"
                                            }
                                        },
                                        "valores": {
                                            "anticoagulantes": "sim",
                                            "qual_anticoagulante": "Apixabano 5 mg"
                                        },
                                        "paciente_id": 1204,
                                        "episodio_id": 77,
                                        "episodio": {
                                            "id": 77,
                                            "numero": "E-2026-0077",
                                            "titulo": "FUE — zona frontal",
                                            "estado": "avaliacao",
                                            "estado_rotulo": "Avaliação"
                                        },
                                        "consentimentos": [
                                            {
                                                "finalidade": "tratamento_clinico",
                                                "texto": "O paciente autorizou presencialmente o tratamento dos dados de saúde deste formulário.",
                                                "modelo_id": null
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/formularios/{id}/respostas": {
            "post": {
                "tags": [
                    "Formulários"
                ],
                "operationId": "m1ResponderFormulario",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Form identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Save a response (team or integration)",
                "description": "Team and integrations (an integration clinical scopes only apply once the client clinical justification is approved). Answers are validated against the current version schema: questions hidden by the conditional rule are dropped, missing required ones and values of the wrong type → 422 with the question key. Values: texto and textoLongo (up to the question maximum), escolha (option value), multipla (list or comma-separated), escala (integer in range), numero (in range; rounded to the decimals), simnao («sim»/«nao»), data, grelha ({row: column}), fotografia (file identifiers of the clinic, belonging to the patient or without owner), assinatura (file identifier or PNG data URL up to 2 MB). Saved by the team it is «validado»; by an integration it gets the «agente» source and «por_validar». A given patient must exist (422) and be in scope (403). Effects: encrypted answers, score and band, alerts declared in the schema (awaiting validation when not the team), alarm → urgent task and notice to the schema department, pre-assessment → medical review task, timeline, «criar» audit, formulario.respondido webhook (without answers). Legal basis before saving health data: with a patient or lead, the «tratamento_clinico» consent (and «fotografias_clinicas» when the answers contain photos) must already be recorded or be declared in «consentimentos» ({finalidade: true}); without it nothing is saved and the response is 422 with the per-field error «consentimentos.<finalidade>». Declarations are recorded immutably («presencial» channel by the team, «agente_voz» by an integration). Limit (default): 120 requests per minute per team token; integrations use the per-minute limit set on the integration client (429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "respostas": {
                                        "type": "object",
                                        "additionalProperties": true,
                                        "description": "Question key → value."
                                    },
                                    "paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "lead_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "consulta_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "marco_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "idioma": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de",
                                            null
                                        ]
                                    },
                                    "consentimentos": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "boolean"
                                        },
                                        "description": "Consents declared in this submission: {finalidade: true}."
                                    },
                                    "aviso_testemunho": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Token of the notice shown to the patient in person (from «aviso» in GET …/preencher); recorded with the «presencial» medium."
                                    }
                                },
                                "required": [
                                    "respostas"
                                ]
                            },
                            "example": {
                                "respostas": {
                                    "anticoagulantes": "sim",
                                    "qual_anticoagulante": "Apixabano 5 mg",
                                    "impacto": 7
                                },
                                "paciente_id": 1204,
                                "episodio_id": 77,
                                "idioma": "pt-PT",
                                "consentimentos": {
                                    "tratamento_clinico": true
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1ResultadoResposta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "resposta_id": 5121,
                                        "estado": "validado",
                                        "pontuacao": 7,
                                        "faixa": {
                                            "rotulo": "Elevado",
                                            "tom": "aviso"
                                        },
                                        "alarme": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/formularios/{id}/traduzir": {
            "post": {
                "tags": [
                    "Formulários"
                ],
                "operationId": "m1TraduzirFormulario",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Form identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Translate with the clinic's AI assistant",
                "description": "Translates the name, description and every schema text into the requested language (the schema carries no patient data). Creates a form with the same key in that language — or updates the existing one — always inactive until someone reviews and activates it. 422: language outside the list, same as the original, use not configured or assistant failure. Effects: version copy, «criar» audit with the model used. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After). Additional limit: 10 requests per 10 minutes per IP address (only data-changing requests count).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    }
                                },
                                "required": [
                                    "idioma"
                                ]
                            },
                            "example": {
                                "idioma": "en"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1Formulario"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 40,
                                        "chave": "questionario_previo_fue",
                                        "nome": "Pre-consultation questionnaire — FUE",
                                        "descricao": "To be completed before the first consultation.",
                                        "tipo": "questionario_previo",
                                        "tipo_rotulo": "Questionário prévio",
                                        "tecnica": "FUE",
                                        "versao": 1,
                                        "idioma": "en",
                                        "ativo": false,
                                        "modelo": false,
                                        "expira_dias": 14,
                                        "publicado_em": "2026-10-20T15:40:00+01:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/galeria/anotacoes/{id}": {
            "put": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "alterarCamadaAnotacoes",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Update a layer",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string"
                                    },
                                    "ordem": {
                                        "type": "integer"
                                    },
                                    "visivel": {
                                        "type": "boolean"
                                    },
                                    "elementos": {
                                        "type": "array",
                                        "items": {
                                            "$ref": "#/components/schemas/ElementoDesenho"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Anotacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "apagarCamadaAnotacoes",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Delete a layer (the photo does not change)",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Anotacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/galeria/anterior": {
            "get": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "fotografiaAnterior",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "ver",
                "summary": "Previous photo of the same view (overlay)",
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient"
                    },
                    {
                        "name": "vista",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "View"
                    },
                    {
                        "name": "excluir",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Capture to exclude"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "oneOf": [
                                                {
                                                    "$ref": "#/components/schemas/Foto"
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/galeria/captura3d/configuracao": {
            "get": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "configuracaoCaptura3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "ver",
                "summary": "3D capture and sensor protocol parameters",
                "description": "Warning distances (cm) and max speeds, head radius, reconstruction grid, coverage grid (same as the server), minimum coverage, level/distance tolerances and the guided-photo protocol.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/galeria/capturas": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "criarCaptura",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Create capture",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "avaliacao",
                                            "pre_operatorio",
                                            "cirurgia",
                                            "seguimento"
                                        ]
                                    },
                                    "protocolo_id": {
                                        "type": "integer"
                                    },
                                    "marco_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "data": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "notas": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "paciente_id",
                                    "tipo"
                                ]
                            },
                            "example": {
                                "paciente_id": 1204,
                                "tipo": "seguimento",
                                "protocolo_id": 4,
                                "marco_id": 5120
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 812
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/galeria/capturas/{id}/fotos": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "carregarFotoCaptura",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Upload the photo of a view",
                "description": "Type checked by content, EXIF/GPS stripped, encrypted at rest. Server-side quality scoring (resolution, Laplacian-variance sharpness, brightness); insufficient quality flags the capture for repetition.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "vista": {
                                        "type": "string"
                                    },
                                    "zona": {
                                        "type": "string"
                                    },
                                    "etiquetas": {
                                        "type": "string",
                                        "description": "Comma-separated"
                                    },
                                    "album": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "foto": {
                                                    "$ref": "#/components/schemas/Foto"
                                                },
                                                "qualidade": {
                                                    "$ref": "#/components/schemas/Qualidade"
                                                },
                                                "repetir": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "foto": {
                                            "id": 9001,
                                            "vista": "topo"
                                        },
                                        "qualidade": {
                                            "avaliada": true,
                                            "ok": true,
                                            "pontuacao": 86.4
                                        },
                                        "repetir": false
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/galeria/capturas/{id}/repetir": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "repetirCaptura",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Request the capture be repeated",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "maxLength": 255
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            },
                            "example": {
                                "motivo": "Pouca luz na vista do topo"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/galeria/comparar": {
            "get": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "compararFotos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "ver",
                "summary": "Compare two photos",
                "parameters": [
                    {
                        "name": "a",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Photo A"
                    },
                    {
                        "name": "b",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Photo B"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "antes": {
                                                    "$ref": "#/components/schemas/Foto"
                                                },
                                                "depois": {
                                                    "$ref": "#/components/schemas/Foto"
                                                },
                                                "dias": {
                                                    "type": "integer"
                                                },
                                                "texto": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/galeria/fotos/{id}/anotacoes": {
            "get": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "anotacoesFoto",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "ver",
                "summary": "Drawings on the photo (vector layers)",
                "description": "Layers with stroke, arrow, text and measurement elements in 0–1 fractions of the image; the original photo never changes. Shared web/app drawing rule: 1000 px width reference. Measurements carry comprimento_px and, with a reference measurement (referencia_mm), comprimento_mm.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Anotacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "criarCamadaAnotacoes",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Create a drawing layer",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string",
                                        "maxLength": 80
                                    },
                                    "ordem": {
                                        "type": "integer"
                                    },
                                    "visivel": {
                                        "type": "boolean"
                                    },
                                    "elementos": {
                                        "type": "array",
                                        "items": {
                                            "$ref": "#/components/schemas/ElementoDesenho"
                                        }
                                    }
                                },
                                "required": [
                                    "elementos"
                                ]
                            },
                            "example": {
                                "nome": "Linha frontal proposta",
                                "elementos": [
                                    {
                                        "id": "e1",
                                        "tipo": "traco",
                                        "pontos": [
                                            [
                                                0.3,
                                                0.22
                                            ],
                                            [
                                                0.5,
                                                0.18
                                            ],
                                            [
                                                0.7,
                                                0.22
                                            ]
                                        ],
                                        "cor": "ouro",
                                        "espessura": 3,
                                        "tracejado": true
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Anotacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/galeria/fotos/{id}/desfocar": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "desfocarFoto",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Copy with the face blurred for export",
                "description": "Region as image fractions (0–1). The original is unchanged. «export» audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "x": {
                                        "type": "number"
                                    },
                                    "y": {
                                        "type": "number"
                                    },
                                    "largura": {
                                        "type": "number"
                                    },
                                    "altura": {
                                        "type": "number"
                                    }
                                },
                                "required": [
                                    "x",
                                    "y",
                                    "largura",
                                    "altura"
                                ]
                            },
                            "example": {
                                "x": 0.3,
                                "y": 0.05,
                                "largura": 0.4,
                                "altura": 0.35
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "foto": {
                                                    "$ref": "#/components/schemas/Foto"
                                                },
                                                "descarregar": {
                                                    "type": "string",
                                                    "format": "uri"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/galeria/fotos/{id}/etiquetas": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "etiquetarFoto",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Tags, zone, album and view",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "etiquetas": {
                                        "oneOf": [
                                            {
                                                "type": "array",
                                                "items": {
                                                    "type": "string"
                                                }
                                            },
                                            {
                                                "type": "string"
                                            }
                                        ]
                                    },
                                    "zona": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "album": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "vista": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "etiquetas": [
                                    "linha frontal",
                                    "controlo"
                                ],
                                "album": "Casos 2026"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Foto"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/galeria/fotos/{id}/exportar": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "exportarFotoComunicacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Export for communication (face blurred without image consent)",
                "description": "Without a valid «imagens_comunicacao» consent, the export is ALWAYS a copy with the face blurred; with consent, blurring is optional. Simulations → 422. The original never changes; the export is audited.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "finalidade": {
                                        "type": "string",
                                        "enum": [
                                            "comunicacao"
                                        ]
                                    },
                                    "caixas": {
                                        "type": "array",
                                        "items": {
                                            "$ref": "#/components/schemas/Caixa"
                                        }
                                    },
                                    "desfocar": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "finalidade": "comunicacao"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "foto": {
                                                    "$ref": "#/components/schemas/Foto"
                                                },
                                                "descarregar": {
                                                    "type": "string",
                                                    "format": "uri"
                                                },
                                                "anonimizada": {
                                                    "type": "boolean"
                                                },
                                                "consentimento": {
                                                    "type": "boolean"
                                                },
                                                "metodo": {
                                                    "type": "string"
                                                },
                                                "caixas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Caixa"
                                                    }
                                                },
                                                "aviso": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/galeria/fotos/{id}/partilhar": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "partilharFoto",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Selective sharing with the patient",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "partilhar": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "partilhar"
                                ]
                            },
                            "example": {
                                "partilhar": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Foto"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/galeria/fotos/{id}/rostos": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "rostosFoto",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Locate the face (boxes)",
                "description": "Vision AI detection (only with the patient's «ia» consent). Without detection, returns the typical region for the view (metodo «omissao»). Views without a face: metodo «nenhum».",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "caixas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Caixa"
                                                    }
                                                },
                                                "metodo": {
                                                    "type": "string",
                                                    "enum": [
                                                        "ia",
                                                        "omissao",
                                                        "nenhum"
                                                    ]
                                                },
                                                "analise_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "aviso": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "caixas": [
                                            {
                                                "x": 0.31,
                                                "y": 0.42,
                                                "largura": 0.38,
                                                "altura": 0.46
                                            }
                                        ],
                                        "metodo": "ia",
                                        "analise_id": 812,
                                        "aviso": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/galeria/fotos/{id}/verificar": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "verificarFoto",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "summary": "Accept or reject a patient photo",
                "description": "Rejecting requires a reply (stored encrypted). The patient receives a notification without clinical details.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "aceite",
                                            "rejeitada"
                                        ]
                                    },
                                    "resposta": {
                                        "type": "string",
                                        "maxLength": 1000
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "rejeitada",
                                "resposta": "Repita com luz natural, sem flash."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Foto"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/galeria/modelos3d": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "carregarModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Upload 3D model",
                "description": "GLB, glTF, OBJ, PLY, STL or USDZ, validated by content; stored encrypted. The server reads the mesh (vertices, triangles, area, unit) and measures scalp coverage; the app capture sends origin lidar/profundidade, the device and captura_meta (duration, samples, distance/speed/tracking warnings, % of time with warnings, hex coverage map). Response includes «aviso» when the mesh cannot be read.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro",
                                    "paciente_id"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "captura_id": {
                                        "type": "integer"
                                    },
                                    "cobertura_pct": {
                                        "type": "number"
                                    },
                                    "escala_confirmada": {
                                        "type": "boolean"
                                    },
                                    "qualidade": {
                                        "type": "string",
                                        "enum": [
                                            "boa",
                                            "aceitavel",
                                            "insuficiente"
                                        ]
                                    },
                                    "origem": {
                                        "type": "string",
                                        "enum": [
                                            "carregado",
                                            "lidar",
                                            "profundidade"
                                        ]
                                    },
                                    "aparelho": {
                                        "type": "string"
                                    },
                                    "escala_metodo": {
                                        "type": "string",
                                        "enum": [
                                            "sensor",
                                            "marcador",
                                            "regua",
                                            "manual"
                                        ]
                                    },
                                    "unidade_modelo": {
                                        "type": "string",
                                        "enum": [
                                            "m",
                                            "cm",
                                            "mm"
                                        ]
                                    },
                                    "captura_meta": {
                                        "type": "string",
                                        "description": "JSON"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Modelo3d"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/galeria/modelos3d/partilhas/{id}/revogar": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "revogarPartilhaModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Revoke a preview link",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/galeria/modelos3d/{id}": {
            "get": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "obterModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "ver",
                "summary": "3D model with everything the viewer needs",
                "description": "Signed file link, mesh, head frame, coverage, scale, capture data, markings with triangles, trichoscopy points, hairline, simulated hair, other models, plans, preview links and permissions.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Modelo3d"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "put": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "atualizarModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Landmarks, coverage, scale, quality and areas",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "referencias": {
                                        "type": "object"
                                    },
                                    "cobertura_pct": {
                                        "type": "number"
                                    },
                                    "escala_confirmada": {
                                        "type": "boolean"
                                    },
                                    "qualidade": {
                                        "type": "string"
                                    },
                                    "zonas": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "number"
                                        },
                                        "x-unidade": "cm²"
                                    },
                                    "area_dadora_cm2": {
                                        "type": "number",
                                        "x-unidade": "cm²"
                                    },
                                    "partilhado_paciente": {
                                        "type": "boolean"
                                    },
                                    "notas": {
                                        "type": "string"
                                    },
                                    "espessura_cabelo_mm": {
                                        "type": "number",
                                        "x-unidade": "mm"
                                    },
                                    "unidade_modelo": {
                                        "type": "string",
                                        "enum": [
                                            "m",
                                            "cm",
                                            "mm"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "escala_confirmada": true,
                                "cobertura_pct": 94.5,
                                "zonas": {
                                    "linha_frontal": 15.2,
                                    "coroa": 68.9
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Modelo3d"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/galeria/modelos3d/{id}/diferencas": {
            "get": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "diferencasModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "ver",
                "summary": "Difference map against another model of the patient",
                "description": "Alignment by common landmarks (≥ 3, Horn) refined by closest points. distancias_b64: little-endian int16 per vertex in tenths of mm (−32768 = no match).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "com",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Other model of the same patient"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/galeria/modelos3d/{id}/escala": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "escalaModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Confirm scale with the reference (sticker or ruler)",
                "description": "Two mesh points and the real length in mm. Stores the factor, confirms the scale, returns the difference to the previous scale and re-measures all zones.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "a": {
                                        "type": "object"
                                    },
                                    "b": {
                                        "type": "object"
                                    },
                                    "comprimento_mm": {
                                        "type": "number",
                                        "x-unidade": "mm"
                                    },
                                    "metodo": {
                                        "type": "string",
                                        "enum": [
                                            "marcador",
                                            "regua"
                                        ]
                                    }
                                },
                                "required": [
                                    "a",
                                    "b",
                                    "comprimento_mm"
                                ]
                            },
                            "example": {
                                "a": {
                                    "x": 0.031,
                                    "y": 0.072,
                                    "z": 0.061
                                },
                                "b": {
                                    "x": 0.05,
                                    "y": 0.071,
                                    "z": 0.058
                                },
                                "comprimento_mm": 20,
                                "metodo": "marcador"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/galeria/modelos3d/{id}/linha-frontal": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "linhaFrontalModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Hairline in 3D (with symmetry)",
                "description": "Ordered points. Returns length (cm), height above glabella (cm), mean asymmetry (mm) and 2D diagram projection. Empty list deletes.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "pontos": {
                                        "type": "array",
                                        "items": {
                                            "type": "array",
                                            "items": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "simetria": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "pontos"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/galeria/modelos3d/{id}/partilhas": {
            "get": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "partilhasModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Active preview links",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "partilharModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Create a temporary link to view the model on another device",
                "description": "Returns /m3d/<code> (public page with only the model, no personal data). Only the code’s sha256 is stored. Valid 5–240 minutes.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "minutos": {
                                        "type": "integer"
                                    },
                                    "sem_rosto": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "minutos": 30,
                                "sem_rosto": true
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/galeria/modelos3d/{id}/ponto-diagrama": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "pontoDiagramaModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "ver",
                "summary": "Position of a mesh point on the 2D diagram",
                "description": "Azimuthal projection from the vertex in the head frame. Returns x, y (0–1), suggested subzone and frame source. To save a trichoscopy field with a 3D point, send ponto.modelo3d = {id, x, y, z} to POST /tricoscopia.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "x": {
                                        "type": "number"
                                    },
                                    "y": {
                                        "type": "number"
                                    },
                                    "z": {
                                        "type": "number"
                                    },
                                    "triangulo": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "x",
                                    "y",
                                    "z"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/galeria/modelos3d/{id}/simulacao": {
            "post": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "cabeloSimuladoModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Simulated hair parameters per zone",
                "description": "Per marked zone: density, angle, direction, calibre, wave, colour and length. Illustrative only.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "zonas": {
                                        "type": "object"
                                    },
                                    "plano_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "zonas"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/galeria/modelos3d/{id}/zonas/{zona}": {
            "put": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "marcarZonaModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Mark a zone on the mesh (area measured on the server)",
                "description": "triangulos as ranges «a-b,c,…» in canonical mesh order. Each triangle belongs to one zone only. Returns all markings with skin and surface area (cm²), perimeter (cm) and contour error (%), and the updated model.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "zona",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "linha_frontal",
                                "tufo_central",
                                "frontal",
                                "tempora_esq",
                                "tempora_dir",
                                "media",
                                "coroa",
                                "sobrancelha",
                                "outra",
                                "occipital",
                                "parietal_esq",
                                "parietal_dir"
                            ]
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "triangulos": {
                                        "type": "string"
                                    },
                                    "ferramenta": {
                                        "type": "string",
                                        "enum": [
                                            "pincel",
                                            "laco",
                                            "retangulo",
                                            "misto"
                                        ]
                                    },
                                    "espessura_cabelo_mm": {
                                        "type": "number",
                                        "x-unidade": "mm"
                                    }
                                },
                                "required": [
                                    "triangulos"
                                ]
                            },
                            "example": {
                                "triangulos": "120-388,402,410-415",
                                "ferramenta": "pincel",
                                "espessura_cabelo_mm": 2
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "apagarZonaModelo3d",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Delete a zone marking",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "zona",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/galeria/pacientes/{paciente_id}": {
            "get": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "galeriaPaciente",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "ver",
                "summary": "Patient gallery",
                "description": "Captures with protocol slots (photo per view and missing views), filtered photos, 3D models, protocols, milestones, tags, albums and pending count. 15-minute signed links. Audited.",
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "f[marco]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Milestone"
                    },
                    {
                        "name": "f[vista]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "View"
                    },
                    {
                        "name": "f[zona]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Zone"
                    },
                    {
                        "name": "f[etiqueta]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Tag"
                    },
                    {
                        "name": "f[album]",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Album"
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "por_verificar",
                                "aceite",
                                "rejeitada"
                            ]
                        },
                        "description": "Status"
                    },
                    {
                        "name": "f[simulacao]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "0",
                                "1"
                            ]
                        },
                        "description": "Simulations"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/galeria/por-verificar": {
            "get": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "fotosPorVerificar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "ver",
                "summary": "Patient photos pending review",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Foto"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/galeria/protocolos": {
            "get": {
                "tags": [
                    "Galeria clínica"
                ],
                "operationId": "protocolosFotograficos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "ver",
                "summary": "Active photo protocols",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Protocolo"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/ganchos/anular/{codigo}": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Chat do site e subscrições"
                ],
                "operationId": "anularUmClique",
                "security": [],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "publico",
                "summary": "One-click unsubscribe (List-Unsubscribe-Post)",
                "description": "Used by email clients (RFC 8058). The clinic comes from the send record the code belongs to. Effects: contact added to the email opt-out list, marketing consent revoked, unsubscribe count.",
                "parameters": [
                    {
                        "name": "codigo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{16,128}$"
                        },
                        "description": "Send code"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "List-Unsubscribe": {
                                        "const": "One-Click"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Unsubscribed (or unknown code — same response)"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/faturacao": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Avisos de fornecedores (comercial)"
                ],
                "operationId": "m5GanchoFaturacao",
                "security": [],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "publico",
                "summary": "Invoicing software document status",
                "description": "Updates a «pedido» document with the number, ATCUD and final status. The secret (X-AX-Segredo) is compared with faturacao.gancho_segredo of the clinic owning the document.",
                "parameters": [
                    {
                        "name": "X-AX-Segredo",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic secret"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "externo_id": {
                                        "type": "string"
                                    },
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "emitido",
                                            "erro",
                                            "anulado"
                                        ]
                                    },
                                    "numero": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "atcud": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "erro": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "externo_id",
                                    "estado"
                                ]
                            },
                            "example": {
                                "externo_id": "84512233",
                                "estado": "emitido",
                                "numero": "FR A2026/118",
                                "atcud": "JJ3KX9QW-118"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Handled",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid secret"
                    },
                    "404": {
                        "description": "Unknown document"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/leads/google": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "ganchoLeadsGoogle",
                "security": [],
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "publico",
                "summary": "Google lead forms",
                "description": "Google format (lead_id, user_column_data, form_id, campaign_id, gcl_id, is_test, google_key). «google_key» identifies the clinic (crm.google.chave_leads, constant-time comparison; 401 on mismatch). The lead goes through the queue (idempotent by lead_id) and is created by the funnel; test submissions only confirm the connection. Body ≤ 256 KB. Limit: 300/min per IP.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            },
                            "example": {
                                "lead_id": "TeSter-123-ABCDEFGHIJKLMNOPQRSTUVWXYZ",
                                "user_column_data": [
                                    {
                                        "column_id": "FULL_NAME",
                                        "string_value": "Ana Costa"
                                    },
                                    {
                                        "column_id": "EMAIL",
                                        "string_value": "ana@exemplo.pt"
                                    },
                                    {
                                        "column_id": "PHONE_NUMBER",
                                        "string_value": "+351912345678"
                                    }
                                ],
                                "form_id": 123456,
                                "campaign_id": 987654,
                                "gcl_id": "EAIaIQobChMI…",
                                "is_test": true,
                                "google_key": "••••"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Received"
                    },
                    "400": {
                        "description": "Invalid body"
                    },
                    "401": {
                        "description": "Unknown key"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/pagamentos": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Avisos de fornecedores (comercial)"
                ],
                "operationId": "m5GanchoPagamentos",
                "security": [],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "publico",
                "summary": "Payment notification (Ifthenpay)",
                "description": "URL to configure at the provider: /ganchos/pagamentos?key=[ANTI_PHISHING_KEY]&referencia=[REFERENCE]&valor=[AMOUNT]&pedido=[ORDER_ID]&id_pedido=[REQUEST_ID]&metodo=[PAYMENT_METHOD]. The clinic is resolved from the payment record (Multibanco reference, MB WAY request or link identifier) and the anti-phishing key is compared with that clinic's. The amount must match; the status is confirmed with the provider when possible. Every notification is logged (no personal data). Responds in plain text.",
                "parameters": [
                    {
                        "name": "key",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic anti-phishing key"
                    },
                    {
                        "name": "referencia",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Multibanco reference"
                    },
                    {
                        "name": "pedido",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Order id"
                    },
                    {
                        "name": "id_pedido",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "MB WAY request id"
                    },
                    {
                        "name": "valor",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Amount"
                    },
                    {
                        "name": "metodo",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Method"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Handled (text «OK»)",
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request"
                    },
                    "403": {
                        "description": "Invalid key"
                    },
                    "404": {
                        "description": "Unknown payment"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/telefonia": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "ganchoTelefonia",
                "security": [],
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "publico",
                "summary": "PBX events",
                "description": "One event or {\"eventos\": […]}. The clinic is the owner of the secret (X-AX-Segredo) or signature (X-AX-Assinatura: sha256=HMAC of the body); if the destination number is in a clinic's numbers, only that clinic is tried. Effects: call recorded and linked to the patient/lead by number (new phone-source lead if unknown), missed call → «call back» task with target time, outbound call to a number with a missed call marks it as returned, recording stored only with consent (https or base64) and analysed (summary and script score), inbound SMS → inbox. Transcription: if the event carries «transcricao», that one is kept; a consented recording or voicemail without transcription stays pending and is transcribed by the clinic AI within minutes (scheduler crm.transcricoes; local service first, external only with the patient-data switch).",
                "parameters": [
                    {
                        "name": "X-AX-Segredo",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic secret (or use the signature)."
                    },
                    {
                        "name": "X-AX-Assinatura",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=<HMAC-SHA256 of the body with the secret>"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "evento": {
                                        "type": "string",
                                        "enum": [
                                            "a_tocar",
                                            "atendida",
                                            "terminada",
                                            "perdida",
                                            "correio_voz",
                                            "ocupado",
                                            "sms"
                                        ]
                                    },
                                    "chamada_id": {
                                        "type": "string"
                                    },
                                    "de": {
                                        "type": "string"
                                    },
                                    "para": {
                                        "type": "string"
                                    },
                                    "direcao": {
                                        "type": "string",
                                        "enum": [
                                            "entrada",
                                            "saida"
                                        ]
                                    },
                                    "inicio": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "duracao_s": {
                                        "type": "integer",
                                        "x-unidade": "s"
                                    },
                                    "utilizador_email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "gravacao_consentida": {
                                        "type": "boolean"
                                    },
                                    "gravacao_url": {
                                        "type": "string",
                                        "format": "uri"
                                    },
                                    "gravacao_base64": {
                                        "type": "string"
                                    },
                                    "transcricao": {
                                        "type": "string"
                                    },
                                    "texto": {
                                        "type": "string",
                                        "description": "SMS text (sms event)."
                                    },
                                    "mensagem_id": {
                                        "type": "string"
                                    },
                                    "extensao": {
                                        "type": "string",
                                        "description": "Extension where the call rings (a_tocar event): the person on that extension gets the notice with the contact record and the call shows in the on-screen phone system."
                                    }
                                },
                                "required": [
                                    "evento"
                                ]
                            },
                            "example": {
                                "evento": "perdida",
                                "chamada_id": "pbx-55a1c",
                                "de": "+351912345678",
                                "para": "+351210000000",
                                "direcao": "entrada",
                                "inicio": "2026-10-28T13:05:00+00:00",
                                "duracao_s": 0
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Received",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "chamadas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "chamadas": [
                                            30552
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid body"
                    },
                    "401": {
                        "description": "Invalid secret or signature"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/terminais/stripe": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Avisos de fornecedores (comercial)"
                ],
                "operationId": "m5GanchoTerminalStripe",
                "security": [],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "publico",
                "summary": "Stripe Terminal notification (signed)",
                "description": "Events payment_intent.succeeded, payment_intent.payment_failed, payment_intent.canceled, terminal.reader.action_succeeded and terminal.reader.action_failed. Stripe-Signature header (HMAC-SHA256 of «t.body» with terminais.stripe.segredo_gancho of the clinic owning the charge, 5-minute tolerance). Confirmed by the API (payment_intent «succeeded» and correct amount_received) before marking paid.",
                "parameters": [
                    {
                        "name": "Stripe-Signature",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Stripe signature"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "type": {
                                        "type": "string"
                                    },
                                    "data": {
                                        "type": "object"
                                    }
                                },
                                "required": [
                                    "type",
                                    "data"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Handled",
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Invalid signature"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/terminais/sumup/{token}": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Avisos de fornecedores (comercial)"
                ],
                "operationId": "m5GanchoTerminalSumup",
                "security": [],
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "publico",
                "summary": "SumUp charge notification (Solo)",
                "description": "return_url of each charge (event solo.transaction.updated). SumUp does not sign the notification: the 48-hex token, unique per charge (only its SHA-256 is stored), acts as the secret. The payment only becomes paid after confirmation by the SumUp API, with the right amount.",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{48}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "event_type": {
                                        "type": "string"
                                    },
                                    "payload": {
                                        "type": "object",
                                        "properties": {
                                            "client_transaction_id": {
                                                "type": "string"
                                            },
                                            "merchant_code": {
                                                "type": "string"
                                            },
                                            "status": {
                                                "type": "string",
                                                "enum": [
                                                    "successful",
                                                    "failed"
                                                ]
                                            }
                                        }
                                    },
                                    "timestamp": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "event_type",
                                    "payload"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Handled",
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Invalid token or transaction"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/voz": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "ganchoAgenteVoz",
                "security": [],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "publico",
                "summary": "Voice agent events",
                "description": "One event or {\"eventos\": […]} from the agent provider, grouped by conversa_id. Authentication and clinic via the clinic's agent secret (X-AX-Segredo or X-AX-Assinatura). Events: inicio, transcricao, resumo, intencao, alarme, idioma, marcacao, fim. Effects: agent request, lead when the contact is unknown, booking request for the front desk, alarm sign (clinic keyword or flagged by the provider) → immediately to nursing with an urgent task, passar_equipa → team notified, usage counted.",
                "parameters": [
                    {
                        "name": "X-AX-Segredo",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic agent secret."
                    },
                    {
                        "name": "X-AX-Assinatura",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=<HMAC-SHA256 of the body>"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "evento": {
                                        "type": "string",
                                        "enum": [
                                            "inicio",
                                            "transcricao",
                                            "resumo",
                                            "intencao",
                                            "alarme",
                                            "idioma",
                                            "marcacao",
                                            "fim"
                                        ]
                                    },
                                    "conversa_id": {
                                        "type": "string"
                                    },
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "voz",
                                            "whatsapp",
                                            "chat"
                                        ]
                                    },
                                    "telefone": {
                                        "type": "string"
                                    },
                                    "nome": {
                                        "type": "string"
                                    },
                                    "data_nascimento": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "marcacao",
                                            "informacao",
                                            "pos_operatorio",
                                            "pagamento",
                                            "alarme",
                                            "outro"
                                        ]
                                    },
                                    "intencao": {
                                        "type": "string"
                                    },
                                    "proximo_passo": {
                                        "type": "string"
                                    },
                                    "resumo": {
                                        "type": "string"
                                    },
                                    "transcricao": {
                                        "type": "string"
                                    },
                                    "notas": {
                                        "type": "string",
                                        "description": "Patient-reported notes (pending validation)."
                                    },
                                    "idioma": {
                                        "type": "string"
                                    },
                                    "aviso_ia": {
                                        "type": "boolean"
                                    },
                                    "identificacao_verificada": {
                                        "type": "boolean"
                                    },
                                    "sinal_alarme": {
                                        "type": "boolean"
                                    },
                                    "sinais": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "marcacao": {
                                        "type": "object",
                                        "properties": {
                                            "preferencia": {
                                                "type": "string"
                                            },
                                            "inicio": {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            "tipo_marcacao_id": {
                                                "type": "integer"
                                            }
                                        }
                                    },
                                    "passar_equipa": {
                                        "type": "boolean"
                                    },
                                    "motivo": {
                                        "type": "string"
                                    },
                                    "inicio": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "fim": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "duracao_s": {
                                        "type": "integer",
                                        "x-unidade": "s"
                                    },
                                    "gravacao_consentida": {
                                        "type": "boolean"
                                    },
                                    "gravacao": {
                                        "type": "string",
                                        "description": "https address or base64 content."
                                    }
                                },
                                "required": [
                                    "evento",
                                    "conversa_id"
                                ]
                            },
                            "example": {
                                "evento": "fim",
                                "conversa_id": "va-20261027-2114-77",
                                "canal": "voz",
                                "telefone": "+351936000111",
                                "nome": "Helena Duarte",
                                "tipo": "marcacao",
                                "intencao": "Remarcar consulta de revisão",
                                "resumo": "Pede para mudar a consulta de quinta para a semana seguinte.",
                                "aviso_ia": true,
                                "identificacao_verificada": true,
                                "duracao_s": 143,
                                "passar_equipa": true,
                                "motivo": "Remarcação precisa de confirmação da receção"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Received",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "pedidos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "pedidos": [
                                            77
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid body"
                    },
                    "401": {
                        "description": "Invalid secret or signature"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/voz/audio/{token}": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "vozAudio",
                "security": [],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "publico",
                "summary": "Own voice engine — answer audio",
                "description": "The audio of an answer requested with audio_modo = ligacao. Signed link, valid for 120 s and single use (404 once read or expired).",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{48}\\.[0-9]{10}\\.[a-f0-9]{64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Audio",
                        "content": {
                            "audio/wav": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            },
                            "audio/mpeg": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Invalid, expired or already used link"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/voz/conhecimento": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "ganchoAgenteConhecimento",
                "security": [],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "publico",
                "summary": "Approved knowledge base for the agent",
                "description": "Only content approved for the agent, mandatory AI notice, alarm signs, forbidden topics, recording notice and opening hours. Authenticated with the clinic agent secret (X-AX-Segredo).",
                "parameters": [
                    {
                        "name": "X-AX-Segredo",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic agent secret."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "aviso_ia": {
                                                    "type": "string"
                                                },
                                                "alarmes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "temas_proibidos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "aviso_gravacao": {
                                                    "type": "string"
                                                },
                                                "horario": {
                                                    "type": "object",
                                                    "properties": {
                                                        "dias": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "inicio": {
                                                            "type": "string"
                                                        },
                                                        "fim": {
                                                            "type": "string"
                                                        },
                                                        "agente": {
                                                            "type": "string",
                                                            "enum": [
                                                                "fora_horas",
                                                                "continuo",
                                                                "desligado"
                                                            ]
                                                        }
                                                    }
                                                },
                                                "artigos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "titulo": {
                                                                "type": "string"
                                                            },
                                                            "corpo": {
                                                                "type": "string"
                                                            },
                                                            "categoria": {
                                                                "type": "string"
                                                            },
                                                            "idioma": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "versao": {
                                                                "type": "integer"
                                                            },
                                                            "clinico": {
                                                                "type": "boolean"
                                                            },
                                                            "aprovado_em": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "aviso_ia": "Olá! Sou o assistente virtual da clínica (inteligência artificial)…",
                                        "alarmes": [
                                            "febre",
                                            "sangramento"
                                        ],
                                        "temas_proibidos": [
                                            "diagnóstico"
                                        ],
                                        "aviso_gravacao": "Esta chamada pode ser gravada…",
                                        "horario": {
                                            "dias": [
                                                "1",
                                                "2",
                                                "3",
                                                "4",
                                                "5"
                                            ],
                                            "inicio": "09:00",
                                            "fim": "19:00",
                                            "agente": "fora_horas"
                                        },
                                        "artigos": [
                                            {
                                                "id": 3,
                                                "titulo": "Horário",
                                                "corpo": "Segunda a sexta, das 9h às 19h.",
                                                "categoria": "horario",
                                                "idioma": "pt-PT",
                                                "versao": 1,
                                                "clinico": false,
                                                "aprovado_em": "2026-10-20T10:00:00+00:00"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid secret"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/voz/fim": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "vozFim",
                "security": [],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "publico",
                "summary": "Own voice engine — call end",
                "description": "Closes the call (if still active), records the duration in the month usage and stores the full recording ONLY with consent (gravacao_base64 or https gravacao_url), deleted after crm.telefonia.gravacoes_dias. Can be called after «transferir» or «terminar» (only updates duration and recording). Works even if the clinic has since changed engine.",
                "parameters": [
                    {
                        "name": "X-AX-Segredo",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic agent secret."
                    },
                    {
                        "name": "X-AX-Assinatura",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=<HMAC-SHA256 of the body>"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "chamada_id": {
                                        "type": "string"
                                    },
                                    "duracao_s": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "x-unidade": "s"
                                    },
                                    "motivo": {
                                        "type": "string",
                                        "enum": [
                                            "desligou",
                                            "transferida",
                                            "erro",
                                            "outro"
                                        ]
                                    },
                                    "gravacao_consentida": {
                                        "type": "boolean"
                                    },
                                    "gravacao_base64": {
                                        "type": "string"
                                    },
                                    "gravacao_url": {
                                        "type": "string",
                                        "format": "uri"
                                    },
                                    "correio_voz_base64": {
                                        "type": "string",
                                        "description": "Message left in the menu voicemail (WAV/MP3, ≤ 20 MB): creates the «Call back» task with the transcription."
                                    },
                                    "correio_voz_url": {
                                        "type": "string",
                                        "format": "uri",
                                        "description": "Alternative to correio_voz_base64 (https only)."
                                    }
                                },
                                "required": [
                                    "chamada_id"
                                ]
                            },
                            "example": {
                                "chamada_id": "pbx-7f3a-20261029-2214",
                                "duracao_s": 154,
                                "motivo": "desligou",
                                "gravacao_consentida": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Closed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "sessao": {
                                                    "type": "string"
                                                },
                                                "pedido_id": {
                                                    "type": "integer"
                                                },
                                                "estado": {
                                                    "type": "string",
                                                    "enum": [
                                                        "ativa",
                                                        "transferida",
                                                        "terminada"
                                                    ]
                                                },
                                                "turnos": {
                                                    "type": "integer"
                                                },
                                                "duracao_s": {
                                                    "type": "integer"
                                                },
                                                "gravacao_guardada": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "sessao": "pbx-7f3a-20261029-2214",
                                        "pedido_id": 912,
                                        "estado": "terminada",
                                        "turnos": 4,
                                        "duracao_s": 154,
                                        "gravacao_guardada": false
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid secret or signature"
                    },
                    "404": {
                        "description": "Unknown call"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/voz/saida": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "vozSaida",
                "security": [],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "publico",
                "summary": "Outbound agent — calls to make now",
                "description": "The bridge asks for the calls the agent must make (dialler lists with «who calls» = voice agent). Each contact is reserved for 10 minutes and checked again: objection list, consent/customer exception for commercial calls, clinic days and hours, list window, holidays, quiet hours and execution environment. The bridge dials «para» and, if answered, calls /ganchos/voz/sessao with the chamada_id and «modo»: «saida». Same secret and signature as the voice engine. Only with the own engine and outbound calls switched on.",
                "parameters": [
                    {
                        "name": "X-AX-Segredo",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic agent secret."
                    },
                    {
                        "name": "X-AX-Assinatura",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=<HMAC-SHA256 of the body>"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "max": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 20,
                                        "default": 5
                                    }
                                }
                            },
                            "example": {
                                "max": 5
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Reserved calls",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ativo": {
                                                    "type": "boolean"
                                                },
                                                "chamadas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "chamada_id": {
                                                                "type": "string"
                                                            },
                                                            "para": {
                                                                "type": "string"
                                                            },
                                                            "de": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "lingua": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "pt-PT",
                                                                    "pt-BR",
                                                                    "en",
                                                                    "es",
                                                                    "fr",
                                                                    "de"
                                                                ]
                                                            },
                                                            "lista_id": {
                                                                "type": "integer"
                                                            },
                                                            "contacto_id": {
                                                                "type": "integer"
                                                            },
                                                            "tipo": {
                                                                "type": "string"
                                                            },
                                                            "finalidade": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "marketing",
                                                                    "servico"
                                                                ]
                                                            },
                                                            "expira_em": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            },
                                                            "modo": {
                                                                "const": "saida"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ativo": true,
                                        "chamadas": [
                                            {
                                                "chamada_id": "ax-s-9f2c71d04e",
                                                "para": "+351912345678",
                                                "de": "+351210000000",
                                                "lingua": "pt-PT",
                                                "lista_id": 7,
                                                "contacto_id": 311,
                                                "tipo": "confirmacoes",
                                                "finalidade": "servico",
                                                "expira_em": "2026-10-29T10:10:00+00:00",
                                                "modo": "saida"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid secret or signature"
                    },
                    "409": {
                        "description": "Own engine off"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/voz/saida/resultado": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "vozSaidaResultado",
                "security": [],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "publico",
                "summary": "Outbound agent — unanswered call",
                "description": "For reserved calls that never reached /ganchos/voz/sessao. The contact goes back to the queue up to the maximum attempts; «numero_errado» closes it. An answered call ends in /ganchos/voz/fim, which records the outcome (confirmed, cancelled, rescheduled, interested, asked not to be contacted, follow-up done).",
                "parameters": [
                    {
                        "name": "X-AX-Segredo",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic agent secret."
                    },
                    {
                        "name": "X-AX-Assinatura",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=<HMAC-SHA256 of the body>"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "chamada_id": {
                                        "type": "string"
                                    },
                                    "resultado": {
                                        "type": "string",
                                        "enum": [
                                            "nao_atendeu",
                                            "ocupado",
                                            "correio_voz",
                                            "numero_errado",
                                            "falhou",
                                            "rejeitada"
                                        ]
                                    }
                                },
                                "required": [
                                    "chamada_id"
                                ]
                            },
                            "example": {
                                "chamada_id": "ax-s-9f2c71d04e",
                                "resultado": "nao_atendeu"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Recorded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "contacto_id": {
                                                    "type": "integer"
                                                },
                                                "estado": {
                                                    "type": "string"
                                                },
                                                "resultado": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid secret or signature"
                    },
                    "404": {
                        "description": "Unknown call"
                    },
                    "422": {
                        "description": "Invalid identifier"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/voz/sessao": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "vozSessao",
                "security": [],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "publico",
                "summary": "Own voice engine — call start",
                "description": "Called by the clinic phone bridge when it hands a call to the agent (only with crm.agente.motor = proprio; 409 «motor_externo» otherwise). Authentication and clinic via the agent secret (X-AX-Segredo or X-AX-Assinatura). Creates the agent request (voice channel, own engine) and returns the greeting with the mandatory AI notice in the call language (the given one, the dialling code one or the Settings one). If the agent cannot answer (switched off, outside its hours or monthly minutes used up), it returns «transferir» (clinic open or extension set) or «terminar» with the unavailability message. Repeating the start of the same call returns the same greeting. Limit: 300 per minute per IP.",
                "parameters": [
                    {
                        "name": "X-AX-Segredo",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic agent secret."
                    },
                    {
                        "name": "X-AX-Assinatura",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=<HMAC-SHA256 of the body>"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "chamada_id": {
                                        "type": "string",
                                        "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]{0,189}$",
                                        "description": "Call identifier on the bridge (unique per clinic)."
                                    },
                                    "de": {
                                        "type": "string"
                                    },
                                    "para": {
                                        "type": "string"
                                    },
                                    "lingua": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    },
                                    "nome": {
                                        "type": "string"
                                    },
                                    "gravacao_pedida": {
                                        "type": "boolean",
                                        "description": "The bridge will record: the greeting includes the recording notice."
                                    },
                                    "gravacao_consentida": {
                                        "type": "boolean"
                                    },
                                    "audio_modo": {
                                        "type": "string",
                                        "enum": [
                                            "base64",
                                            "ligacao",
                                            "nenhum"
                                        ],
                                        "default": "base64"
                                    },
                                    "modo": {
                                        "type": "string",
                                        "enum": [
                                            "agente",
                                            "menu",
                                            "saida"
                                        ],
                                        "default": "agente",
                                        "description": "«menu»: the voice menu of the «para» number (or the main one) answers; «saida»: call made by the agent with the chamada_id received from /ganchos/voz/saida. In both, the start plays the clinic's current phone privacy notice."
                                    }
                                },
                                "required": [
                                    "chamada_id"
                                ]
                            },
                            "example": {
                                "chamada_id": "pbx-7f3a-20261029-2214",
                                "de": "+351912345678",
                                "para": "+351210000000",
                                "gravacao_pedida": false,
                                "audio_modo": "base64"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Greeting",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmRespostaVoz"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "sessao": "pbx-7f3a-20261029-2214",
                                        "pedido_id": 912,
                                        "turno": 0,
                                        "lingua": "pt-PT",
                                        "texto": "Olá! Sou o assistente virtual da clínica (inteligência artificial). Posso ajudar com informações e marcações; a qualquer momento pode pedir para falar com uma pessoa. Em que posso ajudar?",
                                        "audio": {
                                            "formato": "wav",
                                            "mime": "audio/wav",
                                            "duracao_ms": 8120,
                                            "base64": "UklGRiQ…"
                                        },
                                        "acao": "continuar",
                                        "destino": null,
                                        "servicos": {
                                            "transcricao": null,
                                            "resposta": null,
                                            "fala": "local"
                                        },
                                        "max_segundos_fala": 60,
                                        "inicio": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid secret or signature"
                    },
                    "409": {
                        "description": "Own engine off or call already ended"
                    },
                    "422": {
                        "description": "Invalid call identifier"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ganchos/voz/turno": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "vozTurno",
                "security": [],
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "publico",
                "summary": "Own voice engine — one caller turn",
                "description": "The bridge sends each caller turn: WAV audio (base64, up to 8 MB and up to crm.agente.voz_max_segundos) or the text it already transcribed. The server listens (transcription: local service first, external as fallback only with the patient-data switch), checks the clinic alarm signs, requests to speak to a person and limits, answers only from the approved knowledge base and speaks the answer. Actions: «continuar» (play the audio and record the next turn), «transferir» (with destino: department and extension/number) or «terminar» (play and hang up). Alarm sign → urgent task for nursing and «transferir» to the alarm extension. «sequencia» makes the request repeatable: the same sequence returns the same answer without listening again. Turn audio is never stored nor logged. Limits: 1800 per minute per IP; 30 per minute per call.",
                "parameters": [
                    {
                        "name": "X-AX-Segredo",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic agent secret."
                    },
                    {
                        "name": "X-AX-Assinatura",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=<HMAC-SHA256 of the body>"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "chamada_id": {
                                        "type": "string"
                                    },
                                    "audio_base64": {
                                        "type": "string",
                                        "description": "Turn WAV (PCM), base64. The local service only accepts WAV; other formats (MP3, OGG, FLAC, WEBM, M4A) only via the external service."
                                    },
                                    "texto": {
                                        "type": "string",
                                        "maxLength": 2000,
                                        "description": "Instead of audio: the text already transcribed by the bridge."
                                    },
                                    "sequencia": {
                                        "type": "integer",
                                        "minimum": 0
                                    },
                                    "gravacao_consentida": {
                                        "type": "boolean"
                                    },
                                    "audio_modo": {
                                        "type": "string",
                                        "enum": [
                                            "base64",
                                            "ligacao",
                                            "nenhum"
                                        ]
                                    },
                                    "digitos": {
                                        "type": "string",
                                        "pattern": "^[0-9*#]{1,12}$",
                                        "description": "Keys pressed (voice menu or identification code)."
                                    },
                                    "sem_resposta": {
                                        "type": "boolean",
                                        "description": "The person did not answer within «recolher.espera_s»."
                                    }
                                },
                                "required": [
                                    "chamada_id"
                                ]
                            },
                            "example": {
                                "chamada_id": "pbx-7f3a-20261029-2214",
                                "sequencia": 1,
                                "audio_base64": "UklGRiQ…"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Agent answer",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CrmRespostaVoz"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "sessao": "pbx-7f3a-20261029-2214",
                                        "pedido_id": 912,
                                        "turno": 1,
                                        "lingua": "pt-PT",
                                        "texto": "A clínica está aberta de segunda a sexta, das nove às dezanove. Quer que deixe um pedido de marcação para a receção confirmar?",
                                        "audio": {
                                            "formato": "wav",
                                            "mime": "audio/wav",
                                            "duracao_ms": 6400,
                                            "base64": "UklGRiQ…"
                                        },
                                        "acao": "continuar",
                                        "destino": null,
                                        "servicos": {
                                            "transcricao": "local",
                                            "resposta": "local",
                                            "fala": "local"
                                        },
                                        "max_segundos_fala": 60
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid secret or signature"
                    },
                    "404": {
                        "description": "Unknown call (start with /ganchos/voz/sessao)"
                    },
                    "409": {
                        "description": "Own engine off or call already ended/transferred"
                    },
                    "413": {
                        "description": "Audio too large"
                    },
                    "422": {
                        "description": "No audio nor text, invalid or too long audio"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    },
                    "500": {
                        "description": "Internal error: the bridge should hand the call to a person"
                    },
                    "503": {
                        "description": "Engine not installed on the server yet"
                    }
                }
            }
        },
        "/ganchos/whatsapp": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "ganchoWhatsappVerificar",
                "security": [],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "publico",
                "summary": "Endpoint verification (WhatsApp Cloud)",
                "description": "Returns hub.challenge as text when hub.verify_token matches an active clinic's verification code; 403 otherwise.",
                "parameters": [
                    {
                        "name": "hub.mode",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "subscribe"
                            ]
                        },
                        "description": "Mode"
                    },
                    {
                        "name": "hub.verify_token",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Verification code"
                    },
                    {
                        "name": "hub.challenge",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Challenge"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Challenge",
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Invalid code"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Avisos de fornecedores (CRM)"
                ],
                "operationId": "ganchoWhatsappReceber",
                "security": [],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "publico",
                "summary": "Messages and statuses (WhatsApp, Instagram, Messenger)",
                "description": "Meta format. The clinic is resolved from the receiving WhatsApp LINE (metadata.phone_number_id = identifier of an active line; falls back to the number in Settings) or from the page/account (crm.meta.paginas) — never by default. The X-Hub-Signature-256 signature is verified with that clinic's app secret (WhatsApp or crm.meta.app_secret; 401 on failure). Effects: inbox message (the conversation keeps the line and receiving account), new lead for unknown contacts, CONFIRMAR/STOP, photos for review, delivery statuses (WhatsApp «statuses», Messenger «delivery» and «read», Instagram «read»), ad form leads (page → changes[].field = «leadgen»: the lead is read from Meta with the clinic key and created through the funnel), out-of-hours or virtual assistant reply.",
                "parameters": [
                    {
                        "name": "X-Hub-Signature-256",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=<HMAC-SHA256 of the body with the app secret>"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            },
                            "example": {
                                "object": "whatsapp_business_account",
                                "entry": [
                                    {
                                        "id": "1029384756",
                                        "changes": [
                                            {
                                                "field": "messages",
                                                "value": {
                                                    "messaging_product": "whatsapp",
                                                    "metadata": {
                                                        "display_phone_number": "351210000000",
                                                        "phone_number_id": "109876543210"
                                                    },
                                                    "contacts": [
                                                        {
                                                            "profile": {
                                                                "name": "Ricardo"
                                                            },
                                                            "wa_id": "351912345678"
                                                        }
                                                    ],
                                                    "messages": [
                                                        {
                                                            "from": "351912345678",
                                                            "id": "wamid.HBgM…",
                                                            "timestamp": "1730107620",
                                                            "type": "text",
                                                            "text": {
                                                                "body": "CONFIRMAR"
                                                            }
                                                        }
                                                    ]
                                                }
                                            }
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Received",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "tratados": {
                                            "type": "integer"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid body"
                    },
                    "401": {
                        "description": "Invalid signature or unknown clinic"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/ia-propostas/{id}/decisao": {
            "post": {
                "tags": [
                    "Consultas"
                ],
                "operationId": "m1DecidirPropostaIa",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "AI proposal identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Accept, correct or refuse an AI proposal",
                "description": "Requires «edit» on ficha.clinica and the patient in clinical scope; triage proposals may also be decided by nurses, the others only by doctors (403). Pending proposals only (already decided → 422). «aceite» uses the proposed value, «corrigida» requires valor_final, «recusada» accepts a reason (cut at 400 characters). On a draft consultation the value goes into the field (texts appended to what was there; scale, grade, BASP and miniaturisation replaced); on a signed consultation only the decision is kept (use an addendum). Effects: «aprovar» audit with type, field and model; when applied, the consultation save and its audit. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "aceite",
                                            "corrigida",
                                            "recusada"
                                        ]
                                    },
                                    "valor_final": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Required with «corrigida»."
                                    },
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 400
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "corrigida",
                                "valor_final": "Alergia a penicilina (urticária em 2019)."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "proposta": {
                                                    "$ref": "#/components/schemas/M1PropostaIa"
                                                },
                                                "consulta": {
                                                    "oneOf": [
                                                        {
                                                            "$ref": "#/components/schemas/M1Consulta"
                                                        },
                                                        {
                                                            "type": "null"
                                                        }
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "proposta": {
                                            "id": 9120,
                                            "paciente_id": 1204,
                                            "episodio_id": 77,
                                            "consulta_id": 4410,
                                            "resposta_id": null,
                                            "tipo": "escriba",
                                            "tipo_rotulo": "Escriba",
                                            "campo": "alergias",
                                            "campo_rotulo": "Alergias",
                                            "valor_proposto": "Alergia a penicilina (exantema).",
                                            "excerto_origem": "sou alérgico à penicilina, fiquei cheio de manchas",
                                            "fatores": {
                                                "excerto_verificado": true,
                                                "confianca_modelo": 0.92
                                            },
                                            "confianca": 0.92,
                                            "estado": "corrigida",
                                            "estado_rotulo": "Corrigida",
                                            "valor_final": "Alergia a penicilina (urticária em 2019).",
                                            "decidido_por": "Inês Valente",
                                            "decidido_em": "2026-10-28T10:30:00+00:00",
                                            "motivo": null,
                                            "lote": "3f2a9c0d6b1e4a7f8c2d5e9b0a1f3c4d",
                                            "criado_em": "2026-10-28T10:22:00+00:00"
                                        },
                                        "consulta": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/indicadores": {
            "get": {
                "tags": [
                    "Indicadores"
                ],
                "operationId": "listarGruposDeIndicadores",
                "summary": "Visible groups, catalogue and filter options",
                "description": "Only groups allowed by the matrix (indicadores.financeiros|vendas|operacionais|atendimento). 403 if none.",
                "x-anagen-modulo": "indicadores.vendas",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "indicadores.financeiros:ver"
                        ]
                    },
                    {
                        "integracao": [
                            "indicadores.vendas:ver"
                        ]
                    },
                    {
                        "integracao": [
                            "indicadores.operacionais:ver"
                        ]
                    },
                    {
                        "integracao": [
                            "indicadores.atendimento:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/GruposDeIndicadores"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/indicadores/{grupo}": {
            "get": {
                "tags": [
                    "Indicadores"
                ],
                "operationId": "calcularIndicadores",
                "summary": "Indicators of a group",
                "description": "Each indicator comes as blocks: «kpis» (value, previous, % change), «grafico» (series linking to the filtered list) and, when useful, «lista» or «alerta». Indicators whose modules are not yet active come with disponivel=false and the missing list.\n\nDoctors with «own» scope see only their figures. Never clinical content — aggregates only.",
                "x-anagen-modulo": "indicadores.vendas",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "indicadores.vendas:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "grupo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "financeiros",
                                "vendas",
                                "operacionais",
                                "atendimento"
                            ]
                        },
                        "example": "vendas"
                    },
                    {
                        "name": "indicadores",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Only these indicators (comma separated).",
                        "example": "leads_origem,conversao"
                    },
                    {
                        "name": "periodo",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "mes",
                                "mes_anterior",
                                "30d",
                                "90d",
                                "trimestre",
                                "ano",
                                "ano_anterior",
                                "12m"
                            ]
                        },
                        "description": "Preset period (default: current month).",
                        "example": "30d"
                    },
                    {
                        "name": "de",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Custom start (with «ate»; overrides «periodo»).",
                        "example": "2026-10-01"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Custom end (inclusive).",
                        "example": "2026-10-31"
                    },
                    {
                        "name": "medico_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Filter by doctor (forced to oneself when scope is «own»)."
                    },
                    {
                        "name": "comercial_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Filter by responsible sales/front-desk person."
                    },
                    {
                        "name": "origem",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "site",
                                "pre_avaliacao",
                                "meta",
                                "google",
                                "whatsapp",
                                "instagram",
                                "messenger",
                                "telefone",
                                "presencial",
                                "recomendacao",
                                "agente_voz",
                                "outro"
                            ]
                        },
                        "description": "Lead origin.",
                        "example": "meta"
                    },
                    {
                        "name": "procedimento_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Procedure."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoIndicadores"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "grupo": "financeiros",
                                        "titulo": "Financeiros",
                                        "filtros": {
                                            "periodo": "mes",
                                            "de": "2026-10-01",
                                            "ate": "2026-10-28",
                                            "ant_de": "2026-09-01",
                                            "ant_ate": "2026-09-28"
                                        },
                                        "indicadores": [
                                            {
                                                "chave": "faturacao",
                                                "grupo": "financeiros",
                                                "titulo": "Faturação",
                                                "disponivel": true,
                                                "blocos": [
                                                    {
                                                        "tipo": "kpis",
                                                        "itens": [
                                                            {
                                                                "rotulo": "Faturação",
                                                                "valor": 48250,
                                                                "anterior": 41210.5,
                                                                "delta": 17.1,
                                                                "delta_rotulo": "vs. período anterior",
                                                                "formato": "moeda",
                                                                "unidade": "€",
                                                                "ligacao": {
                                                                    "web": "equipa/r/pagamentos?f[estado]=pago",
                                                                    "app": "/r/pagamentos?f[estado]=pago"
                                                                }
                                                            }
                                                        ]
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/indicadores/{grupo}/exportar": {
            "get": {
                "tags": [
                    "Indicadores"
                ],
                "operationId": "exportarIndicadores",
                "summary": "Export the group as CSV",
                "description": "CSV with «;» separator, UTF-8 with BOM: indicator, metric, series, x, value, previous, change and unit. Requires «export» on the group module and is audited.",
                "x-anagen-modulo": "indicadores.vendas",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "indicadores.vendas:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "grupo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "financeiros",
                                "vendas",
                                "operacionais",
                                "atendimento"
                            ]
                        },
                        "example": "vendas"
                    },
                    {
                        "name": "periodo",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "mes",
                                "mes_anterior",
                                "30d",
                                "90d",
                                "trimestre",
                                "ano",
                                "ano_anterior",
                                "12m"
                            ]
                        },
                        "description": "Preset period (default: current month).",
                        "example": "30d"
                    },
                    {
                        "name": "de",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Custom start (with «ate»; overrides «periodo»).",
                        "example": "2026-10-01"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Custom end (inclusive).",
                        "example": "2026-10-31"
                    },
                    {
                        "name": "medico_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Filter by doctor (forced to oneself when scope is «own»)."
                    },
                    {
                        "name": "comercial_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Filter by responsible sales/front-desk person."
                    },
                    {
                        "name": "origem",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "site",
                                "pre_avaliacao",
                                "meta",
                                "google",
                                "whatsapp",
                                "instagram",
                                "messenger",
                                "telefone",
                                "presencial",
                                "recomendacao",
                                "agente_voz",
                                "outro"
                            ]
                        },
                        "description": "Lead origin.",
                        "example": "meta"
                    },
                    {
                        "name": "procedimento_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Procedure."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "CSV file",
                        "content": {
                            "text/csv": {
                                "schema": {
                                    "type": "string"
                                },
                                "example": "\"Indicador\";\"Métrica\";\"Série\";\"X\";\"Valor\";\"Anterior\";\"Variação\";\"Unidade\"\r\n\"Leads por origem\";\"Leads\";\"\";\"\";\"128\";\"104\";\"23,1\";\"leads\"\r\n"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/integracoes/catalogo": {
            "get": {
                "tags": [
                    "Integrações"
                ],
                "operationId": "catalogoDeOperacoes",
                "summary": "Operation catalogue",
                "description": "Every API operation grouped by area, with the required permission, whether integration credentials are accepted and whether it is public, plus the webhook events. Read from the generated specification — never diverges from the code.",
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "lingua",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pt",
                                "en"
                            ],
                            "default": "pt"
                        },
                        "description": "Language of the summaries.",
                        "example": "pt"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "versao": {
                                                    "type": "string"
                                                },
                                                "servidor": {
                                                    "type": "string"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "documentacao": {
                                                    "type": "string"
                                                },
                                                "referencia": {
                                                    "type": "string"
                                                },
                                                "openapi": {
                                                    "type": "string"
                                                },
                                                "grupos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "nome": {
                                                                "type": "string"
                                                            },
                                                            "descricao": {
                                                                "type": "string"
                                                            },
                                                            "operacoes": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "id": {
                                                                            "type": "string"
                                                                        },
                                                                        "metodo": {
                                                                            "type": "string"
                                                                        },
                                                                        "caminho": {
                                                                            "type": "string"
                                                                        },
                                                                        "resumo": {
                                                                            "type": "string"
                                                                        },
                                                                        "modulo": {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        "nivel": {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        "integracao": {
                                                                            "type": "boolean"
                                                                        },
                                                                        "publico": {
                                                                            "type": "boolean"
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                "webhooks": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "evento": {
                                                                "type": "string"
                                                            },
                                                            "resumo": {
                                                                "type": "string"
                                                            },
                                                            "descricao": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "versao": "1.0.0",
                                        "servidor": "https://clinica.exemplo.pt/api/v1",
                                        "total": 412,
                                        "documentacao": "https://clinica.exemplo.pt/desenvolvedores",
                                        "referencia": "https://clinica.exemplo.pt/desenvolvedores/referencia",
                                        "openapi": "https://clinica.exemplo.pt/api/v1/openapi.json",
                                        "grupos": [
                                            {
                                                "nome": "Tarefas",
                                                "descricao": "Tarefas da equipa.",
                                                "operacoes": [
                                                    {
                                                        "id": "listarTarefas",
                                                        "metodo": "GET",
                                                        "caminho": "/tarefas",
                                                        "resumo": "Listar tarefas",
                                                        "modulo": "equipa.tarefas",
                                                        "nivel": "ver",
                                                        "integracao": true,
                                                        "publico": false
                                                    }
                                                ]
                                            }
                                        ],
                                        "webhooks": [
                                            {
                                                "evento": "tarefa.criada",
                                                "resumo": "Tarefa criada",
                                                "descricao": ""
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/integracoes/consumo": {
            "get": {
                "tags": [
                    "Integrações"
                ],
                "operationId": "consumoDasIntegracoes",
                "summary": "Integration usage",
                "description": "Requests per day, errors (HTTP ≥ 400), average duration, latest requests and webhook deliveries, per credential, as §18.1 blocks.",
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "dias",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 90,
                            "default": 30
                        },
                        "description": "Window in days."
                    },
                    {
                        "name": "cliente",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Only one integration."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ConsumoIntegracoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/licenca": {
            "get": {
                "tags": [
                    "A minha licença"
                ],
                "operationId": "aMinhaLicenca",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "ver",
                "summary": "Licence of the current clinic",
                "description": "Plan, modules (included or not), limits and usage, validity, history without internal reasons and renewal contact. Never the full key nor internal notes. In clinic 1: plataforma = true.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MinhaLicenca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/licenca/estado": {
            "get": {
                "tags": [
                    "A minha licença"
                ],
                "operationId": "estadoDaLicenca",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Light licence state (banners)",
                "description": "For any authenticated account (team or patient). Answers even when the licence is blocked, so the app can explain. Patients receive no contract dates.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EstadoLicenca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "estado": "graca",
                                        "estado_rotulo": "Período de graça",
                                        "tom": "aviso",
                                        "so_leitura": true,
                                        "bloqueada": false,
                                        "fim": "2026-10-20",
                                        "dias_restantes": -8,
                                        "dias_graca": 15,
                                        "dias_graca_restantes": 7,
                                        "aviso": {
                                            "tom": "aviso",
                                            "titulo": "Modo só de leitura",
                                            "texto": "A licença terminou a 20/10/2026…"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/licencas": {
            "get": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "ver",
                "tags": [
                    "Licenças"
                ],
                "operationId": "listarLicencas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "List licences",
                "description": "Superadministrators with an active second factor only. Other accounts: 403 so_superadmin (or segundo_fator_necessario).",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "teste",
                                "ativa",
                                "graca",
                                "expirada",
                                "suspensa",
                                "cancelada"
                            ]
                        },
                        "description": "Effective state."
                    },
                    {
                        "name": "f[plano]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "essencial",
                                "clinica",
                                "grupo",
                                "personalizado"
                            ]
                        }
                    },
                    {
                        "name": "f[expira]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "7",
                                "15",
                                "30",
                                "60",
                                "90"
                            ]
                        },
                        "description": "Ends within N days."
                    },
                    {
                        "name": "ordem",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "example": "fim:asc",
                        "description": "fim | clinica | plano | preco | criado_em, with :asc or :desc."
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Licenca"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "pagina": {
                                                    "type": "integer"
                                                },
                                                "por_pagina": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "criarClinicaELicenca",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Wizard: create the clinic, the licence and the first administrator",
                "description": "In one transaction creates (or licenses, with clinica_id) the clinic, the licence with a unique key, the subdomain and own domains, the main site, syncs active modules, prepares profiles, permissions and settings and creates the first administrator. Then runs each module preparation (result per module), stores the logo (≤ 1 MB) and sends the email invitation (single-use link for password and 2FA). Records the «created» event. ",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PedidoNovaLicenca"
                            },
                            "example": {
                                "clinica_id": null,
                                "clinica": {
                                    "nome": "Clínica Capilar Porto",
                                    "nome_legal": "Clínica Capilar Porto, Lda.",
                                    "nif": "509999990",
                                    "ers_registo": "E123456",
                                    "pais": "PT",
                                    "morada": "Rua da Boavista, 100",
                                    "codigo_postal": "4050-110",
                                    "localidade": "Porto",
                                    "telefone": "+351 220 000 000",
                                    "email": "geral@clinicaporto.pt"
                                },
                                "marca": {
                                    "cor_marca": "#0E5B4F",
                                    "codigo": "PORTO-HAIR",
                                    "subdominio": "porto",
                                    "dominio_site": "www.clinicaporto.pt",
                                    "dominio_portal": null
                                },
                                "licenca": {
                                    "plano": "clinica",
                                    "estado": "ativa",
                                    "inicio": "2026-10-28",
                                    "fim": "2027-10-27",
                                    "dias_graca": 15,
                                    "renovacao_automatica": true,
                                    "modulos": [
                                        "crm.leads",
                                        "agenda"
                                    ],
                                    "max_utilizadores": 25,
                                    "max_armazenamento_gb": 500,
                                    "max_locais": 2,
                                    "preco": 590,
                                    "periodicidade": "mensal",
                                    "moeda": "EUR"
                                },
                                "administrador": {
                                    "nome": "Joana Pires",
                                    "email": "joana@clinicaporto.pt"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoNovaLicenca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/licencas/dominios/{id}/apagar": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "removerDominio",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Domain id."
                    }
                ],
                "summary": "Remove a domain",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "apagado": {
                                                    "type": "boolean"
                                                },
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/licencas/dominios/{id}/principal": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "tornarDominioPrincipal",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Domain id."
                    }
                ],
                "summary": "Make a domain the main one",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Dominio"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/licencas/dominios/{id}/verificar": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "verificarDominio",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Domain id."
                    }
                ],
                "summary": "Verify a domain (TXT record)",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Dominio"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "resultado": {
                                                            "type": "object",
                                                            "properties": {
                                                                "ok": {
                                                                    "type": "boolean"
                                                                },
                                                                "mensagem": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/licencas/planos": {
            "get": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "ver",
                "tags": [
                    "Licenças"
                ],
                "operationId": "planosLicencas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Plans, licensable modules and defaults",
                "description": "Each plan's defaults come from the platform settings.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "planos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "modulos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "grupos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "padroes": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/licencas/responsaveis": {
            "get": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "ver",
                "tags": [
                    "Licenças"
                ],
                "operationId": "responsaveisLicencas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Possible account managers (active clinic 1 team)",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "nome": {
                                                        "type": "string"
                                                    },
                                                    "email": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/licencas/resumo": {
            "get": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "ver",
                "tags": [
                    "Licenças"
                ],
                "operationId": "resumoLicencas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Licence KPIs and charts",
                "description": "Active and trial clinics, expiring within 30 days, suspended, monthly recurring revenue, account and storage usage, distribution by state and plan, revenue for the last six months, licences ending and clinics without a licence. ",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResumoLicencas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/licencas/validar": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "validarPassoAssistente",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Validate a wizard step",
                "description": "Step 1 legal data (NIF check digit), 2 brand (unique code and subdomain), 3 licence, 4 administrator, 5 everything. Errors with prefixed field (clinica.nif). Returns code and subdomain suggestions from the name.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "passo": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 5
                                    },
                                    "clinica_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "clinica": {
                                        "type": "object"
                                    },
                                    "marca": {
                                        "type": "object"
                                    },
                                    "licenca": {
                                        "type": "object"
                                    },
                                    "administrador": {
                                        "type": "object"
                                    }
                                },
                                "required": [
                                    "passo"
                                ]
                            },
                            "example": {
                                "passo": 1,
                                "clinica": {
                                    "nome": "Clínica Capilar Porto",
                                    "nome_legal": "Clínica Capilar Porto, Lda.",
                                    "nif": "509999990"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "valido": {
                                                    "type": "boolean"
                                                },
                                                "sugestoes": {
                                                    "type": "object",
                                                    "properties": {
                                                        "codigo": {
                                                            "type": "string"
                                                        },
                                                        "subdominio": {
                                                            "type": "string"
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "valido": true,
                                        "sugestoes": {
                                            "codigo": "CAPILAR-PORTO",
                                            "subdominio": "capilar-porto"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/licencas/{id}": {
            "get": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "ver",
                "tags": [
                    "Licenças"
                ],
                "operationId": "obterLicenca",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Licence detail",
                "description": "Includes domains, immutable history and internal notes. Read is audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Licence id."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Licenca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 3,
                                        "chave": "7KQ2-9XHM-4TRA-PZ8C-W2LD",
                                        "chave_mascarada": "7KQ2-••••-••••-••••-W2LD",
                                        "clinica": {
                                            "id": 7,
                                            "nome": "Clínica Capilar Porto",
                                            "codigo": "PORTO-HAIR",
                                            "localidade": "Porto",
                                            "logotipo_url": null,
                                            "cor_marca": "#0E5B4F",
                                            "ativa": true
                                        },
                                        "plano": "clinica",
                                        "plano_rotulo": "Clínica",
                                        "estado": "ativa",
                                        "estado_efetivo": "ativa",
                                        "estado_rotulo": "Ativa",
                                        "tom": "sucesso",
                                        "so_leitura": false,
                                        "bloqueada": false,
                                        "inicio": "2026-10-28",
                                        "fim": "2027-10-27",
                                        "dias_restantes": 364,
                                        "dias_graca": 15,
                                        "dias_graca_restantes": null,
                                        "renovacao_automatica": true,
                                        "modulos": [
                                            "crm.leads",
                                            "agenda"
                                        ],
                                        "modulos_total": 2,
                                        "limites": {
                                            "utilizadores": 25,
                                            "armazenamento_gb": 500,
                                            "locais": 2
                                        },
                                        "uso": {
                                            "utilizadores": 11,
                                            "armazenamento_bytes": 53687091200,
                                            "armazenamento_gb": 50,
                                            "locais": 1
                                        },
                                        "percentagens": {
                                            "utilizadores": 44,
                                            "armazenamento": 10,
                                            "locais": 50
                                        },
                                        "preco": 590,
                                        "periodicidade": "mensal",
                                        "moeda": "EUR",
                                        "mrr": 590,
                                        "faturacao": {
                                            "nome": "Clínica Capilar Porto, Lda.",
                                            "nif": "509999990",
                                            "email": "contas@clinicaporto.pt"
                                        },
                                        "responsavel": {
                                            "id": 2,
                                            "nome": "Rita Matos"
                                        },
                                        "administrador": {
                                            "id": 41,
                                            "nome": "Joana Pires",
                                            "email": "joana@clinicaporto.pt",
                                            "estado": "convidado",
                                            "ultimo_acesso_em": null
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/licencas/{id}/cancelar": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "cancelarLicenca",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Licence id."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Cancel (reason required)",
                "description": "Data is kept; access is blocked; auto-renewal is turned off. «cancelled» event.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 5,
                                        "maxLength": 500
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Licenca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/licencas/{id}/chave": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "novaChaveLicenca",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Licence id."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Generate a new key",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "chave": {
                                                    "type": "string"
                                                },
                                                "chave_mascarada": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "chave": "9PLM-3QRT-XW4N-7HJK-2ZDA",
                                        "chave_mascarada": "9PLM-••••-••••-••••-2ZDA"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/licencas/{id}/convite": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "reenviarConviteAdministrador",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Licence id."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Resend the invitation to the first administrator",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "enviado": {
                                                    "type": "boolean"
                                                },
                                                "email": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/licencas/{id}/dominios": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "acrescentarDominio",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Licence id."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Add a domain",
                "description": "Subdomains of the base domain are verified; own domains wait for the TXT record «anagensys-verificacao=<token>».",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "dominio": {
                                        "type": "string"
                                    },
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "site",
                                            "portal",
                                            "ambos"
                                        ]
                                    },
                                    "principal": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "dominio"
                                ]
                            },
                            "example": {
                                "dominio": "www.clinicaporto.pt",
                                "tipo": "site"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Dominio"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/licencas/{id}/entrar": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "entrarNaClinica",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Licence id."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Enter the clinic (clinic switcher)",
                "description": "The choice is bound to the token family (like POST /eu/clinica). Audited and recorded in the licence history.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "clinica_id": {
                                                    "type": "integer"
                                                },
                                                "nome": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/licencas/{id}/plano": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "alterarPlanoLicenca",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Licence id."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Change plan, modules, limits, dates, price and billing",
                "description": "Syncs the clinic active modules (modules outside the licence disappear from the menu and are refused by the server). «changed» event with before/after.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "plano": {
                                        "type": "string",
                                        "enum": [
                                            "essencial",
                                            "clinica",
                                            "grupo",
                                            "personalizado"
                                        ]
                                    },
                                    "modulos": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "max_utilizadores": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "max_armazenamento_gb": {
                                        "type": [
                                            "number",
                                            "null"
                                        ]
                                    },
                                    "max_locais": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "inicio": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date"
                                    },
                                    "fim": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date"
                                    },
                                    "dias_graca": {
                                        "type": "integer"
                                    },
                                    "renovacao_automatica": {
                                        "type": "boolean"
                                    },
                                    "preco": {
                                        "type": "number"
                                    },
                                    "periodicidade": {
                                        "type": "string",
                                        "enum": [
                                            "mensal",
                                            "anual"
                                        ]
                                    },
                                    "moeda": {
                                        "type": "string",
                                        "enum": [
                                            "EUR",
                                            "GBP",
                                            "BRL"
                                        ]
                                    },
                                    "faturacao_nome": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "faturacao_nif": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "faturacao_email": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "responsavel_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "plano": "grupo",
                                "modulos": [
                                    "crm.leads",
                                    "agenda",
                                    "bloco.mapa"
                                ],
                                "max_utilizadores": 80,
                                "max_armazenamento_gb": 2000,
                                "max_locais": 10,
                                "preco": 1490,
                                "periodicidade": "mensal"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Licenca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/licencas/{id}/preparar": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "prepararClinica",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Licence id."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Repeat the clinic preparation (idempotent)",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/PreparacaoModulo"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/licencas/{id}/reativar": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "reativarLicenca",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Licence id."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Reactivate a suspended or cancelled licence",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Licenca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/licencas/{id}/renovar": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "renovarLicenca",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Licence id."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Renew",
                "description": "Without «fim», adds a period (monthly/yearly) to the current end or to today if past. Expired becomes active; suspended stays suspended; cancelled is refused. «renewed» event.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "fim": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date"
                                    },
                                    "periodo": {
                                        "type": "string",
                                        "enum": [
                                            "mensal",
                                            "anual"
                                        ]
                                    },
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "periodo": "anual"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Licenca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/licencas/{id}/suspender": {
            "post": {
                "x-anagen-modulo": "plataforma.licencas",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Licenças"
                ],
                "operationId": "suspenderLicenca",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Licence id."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Suspend (reason required)",
                "description": "Immediate block of the clinic team, portal and API (403 licenca_suspensa). Emails the clinic administration, without the internal reason. «suspended» event.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 5,
                                        "maxLength": 500
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            },
                            "example": {
                                "motivo": "Faturas de setembro e outubro por pagar."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Licenca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/m/a/{codigo}/{assinatura}": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Chat do site e subscrições"
                ],
                "operationId": "marketingAbertura",
                "security": [],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "publico",
                "summary": "Campaign email open",
                "description": "1×1 image included only in commercial emails with measurement on and for people with explicit consent. HMAC signature of the code («.gif» at the end). Records the first open and the open count of the send, without storing address, device or browser. Always returns the same GIF, without cookies or cache.",
                "parameters": [
                    {
                        "name": "codigo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{16,128}$"
                        },
                        "description": "Send code"
                    },
                    {
                        "name": "assinatura",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{16}\\.gif$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Image",
                        "content": {
                            "image/gif": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/m/c/{codigo}": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Chat do site e subscrições"
                ],
                "operationId": "marketingClique",
                "security": [],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "publico",
                "summary": "Campaign click tracking",
                "description": "Records the click (email link «l») on the send and redirects to the original destination. Destinations always come from the approved content, never from the request.",
                "parameters": [
                    {
                        "name": "codigo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{16,128}$"
                        },
                        "description": "Send code"
                    },
                    {
                        "name": "l",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        },
                        "description": "Link index in the content"
                    },
                    {
                        "name": "s",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{16}$"
                        },
                        "description": "Link signature (new emails carry it; a wrong signature is refused)"
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Redirects to the destination"
                    },
                    "404": {
                        "description": "Unknown code"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/marketing/campanhas/{id}": {
            "get": {
                "tags": [
                    "Campanhas de marketing"
                ],
                "operationId": "mktObterCampanha",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "ver",
                "summary": "Campaign editor",
                "description": "Campaign, blocks, images usable on the channel, segments, warnings (prices without VAT, result guarantees), legal footer and permissions. Also available to the clinical board without marketing permission, to approve.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MktEditorCampanha"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "campanha": {
                                            "id": 21,
                                            "nome": "Novidades de outono",
                                            "canal": "email",
                                            "tipo": "novidade",
                                            "finalidade": "marketing",
                                            "segmento_id": 3,
                                            "assunto": "Novidades na clínica este outono",
                                            "pre_cabecalho": "Novo horário ao sábado e sessões de esclarecimento",
                                            "conteudo": null,
                                            "estado": "aprovada",
                                            "estado_rotulo": "Aprovada",
                                            "aprovado_por": "Dr. Paulo Faria",
                                            "aprovado_em": "2026-10-27T17:02:00+00:00",
                                            "aprovacao_nota": null,
                                            "aprovacao_pedida_por": "Sofia Martins",
                                            "agendada_para": null,
                                            "enviada_em": null,
                                            "total": 0,
                                            "entregues": 0,
                                            "cliques": 0,
                                            "anulacoes": 0,
                                            "conversoes": 0,
                                            "editavel": false
                                        },
                                        "blocos": [
                                            {
                                                "tipo": "titulo",
                                                "texto": "Abrimos ao sábado"
                                            },
                                            {
                                                "tipo": "texto",
                                                "html": "<p>A partir de novembro, a clínica recebe consultas de avaliação ao sábado de manhã.</p>"
                                            },
                                            {
                                                "tipo": "imagem",
                                                "imagem_id": 5,
                                                "legenda": "A nossa receção"
                                            },
                                            {
                                                "tipo": "botao",
                                                "texto": "Marcar avaliação",
                                                "url": "https://clinica.exemplo.pt/marcar"
                                            },
                                            {
                                                "tipo": "divisoria"
                                            }
                                        ],
                                        "imagens": [],
                                        "segmentos": [
                                            {
                                                "id": 3,
                                                "nome": "Clientes sem visita há um ano",
                                                "contagem": 418,
                                                "usa_dados_clinicos": false
                                            }
                                        ],
                                        "avisos": [],
                                        "rodape": [],
                                        "permissoes": {
                                            "editar": true,
                                            "aprovar": false
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "put": {
                "tags": [
                    "Campanhas de marketing"
                ],
                "operationId": "mktGravarCampanha",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "summary": "Save the campaign",
                "description": "Draft only (409 otherwise). Blocks validated: sanitised HTML, https/mailto/tel links, library images with consent valid for the channel (422 with the reason). SMS and WhatsApp campaigns use «conteudo» (up to 640 characters for SMS).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string",
                                        "maxLength": 120
                                    },
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "email",
                                            "sms",
                                            "whatsapp"
                                        ]
                                    },
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "informacao",
                                            "novidade",
                                            "evento",
                                            "avaliacao",
                                            "reativacao"
                                        ]
                                    },
                                    "finalidade": {
                                        "type": "string",
                                        "enum": [
                                            "marketing",
                                            "servico"
                                        ]
                                    },
                                    "segmento_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "assunto": {
                                        "type": "string",
                                        "maxLength": 190
                                    },
                                    "pre_cabecalho": {
                                        "type": "string",
                                        "maxLength": 190
                                    },
                                    "blocos": {
                                        "type": "array",
                                        "items": {
                                            "$ref": "#/components/schemas/MktBloco"
                                        }
                                    },
                                    "conteudo": {
                                        "type": "string",
                                        "maxLength": 4000
                                    }
                                }
                            },
                            "example": {
                                "nome": "Novidades de outono",
                                "canal": "email",
                                "tipo": "novidade",
                                "finalidade": "marketing",
                                "segmento_id": 3,
                                "assunto": "Novidades na clínica este outono",
                                "pre_cabecalho": "Novo horário ao sábado",
                                "blocos": [
                                    {
                                        "tipo": "titulo",
                                        "texto": "Abrimos ao sábado"
                                    },
                                    {
                                        "tipo": "texto",
                                        "html": "<p>A partir de novembro, a clínica recebe consultas de avaliação ao sábado de manhã.</p>"
                                    },
                                    {
                                        "tipo": "imagem",
                                        "imagem_id": 5,
                                        "legenda": "A nossa receção"
                                    },
                                    {
                                        "tipo": "botao",
                                        "texto": "Marcar avaliação",
                                        "url": "https://clinica.exemplo.pt/marcar"
                                    },
                                    {
                                        "tipo": "divisoria"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MktEditorCampanha"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/marketing/campanhas/{id}/agendar": {
            "post": {
                "tags": [
                    "Campanhas de marketing"
                ],
                "operationId": "mktAgendarCampanha",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "summary": "Schedule sending",
                "description": "Approved only and with the same approved content (409 otherwise). Sending is done in batches by the scheduler, within allowed hours, archiving the content sent. Effects: campanha.enviada webhook at the end.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "agendada_para": {
                                        "type": "string",
                                        "format": "date-time"
                                    }
                                },
                                "required": [
                                    "agendada_para"
                                ]
                            },
                            "example": {
                                "agendada_para": "2026-11-03T10:00:00+00:00"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MktEditorCampanha"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/marketing/campanhas/{id}/aprovar": {
            "post": {
                "tags": [
                    "Campanhas de marketing"
                ],
                "operationId": "mktAprovarCampanha",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "aprovar",
                "summary": "Approve or return (clinical board)",
                "description": "Clinical board only (403 for others). Returning requires a note. Effects: notification to the requester, «approve» audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "aprovar",
                                            "devolver"
                                        ]
                                    },
                                    "nota": {
                                        "type": "string",
                                        "maxLength": 1000
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "aprovar"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MktEditorCampanha"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/marketing/campanhas/{id}/cancelar": {
            "post": {
                "tags": [
                    "Campanhas de marketing"
                ],
                "operationId": "mktCancelarCampanha",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "summary": "Cancel the campaign",
                "description": "Until sending ends; pending sends are marked as not sent («cancelada»).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MktEditorCampanha"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    }
                }
            }
        },
        "/marketing/campanhas/{id}/contar": {
            "post": {
                "tags": [
                    "Campanhas de marketing"
                ],
                "operationId": "mktContarPublico",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "ver",
                "summary": "Count who can receive",
                "description": "Recalculates the segment and applies, contact by contact, the sending rules (consent or customer exception, opt-out list, contact for the channel, double opt-in, explicit consent when the segment uses clinical data).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "enviaveis": {
                                                    "type": "integer"
                                                },
                                                "motivos": {
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "total": 512,
                                        "enviaveis": 418,
                                        "motivos": {
                                            "sem_consentimento": 61,
                                            "suprimido": 9,
                                            "sem_contacto": 24
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/marketing/campanhas/{id}/estatisticas": {
            "get": {
                "tags": [
                    "Campanhas de marketing"
                ],
                "operationId": "mktEstatisticasCampanha",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "ver",
                "summary": "Campaign statistics",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "entregues": {
                                                    "type": "integer"
                                                },
                                                "cliques": {
                                                    "type": "integer"
                                                },
                                                "anulacoes": {
                                                    "type": "integer"
                                                },
                                                "conversoes": {
                                                    "type": "integer"
                                                },
                                                "bloqueados": {
                                                    "type": "integer"
                                                },
                                                "falhados": {
                                                    "type": "integer"
                                                },
                                                "funil": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "x": {
                                                                "type": "string"
                                                            },
                                                            "y": {
                                                                "type": "number"
                                                            },
                                                            "serie": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                },
                                                "cliques_por_dia": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "x": {
                                                                "type": "string"
                                                            },
                                                            "y": {
                                                                "type": "number"
                                                            },
                                                            "serie": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                },
                                                "bloqueios": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "x": {
                                                                "type": "string"
                                                            },
                                                            "y": {
                                                                "type": "number"
                                                            },
                                                            "serie": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                },
                                                "arquivo": {
                                                    "type": [
                                                        "object",
                                                        "array"
                                                    ],
                                                    "description": "Copy of the content as sent."
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "total": 418,
                                        "entregues": 401,
                                        "cliques": 57,
                                        "anulacoes": 3,
                                        "conversoes": 4,
                                        "bloqueados": 94,
                                        "falhados": 2,
                                        "funil": [
                                            {
                                                "x": "Público",
                                                "y": 418
                                            }
                                        ],
                                        "cliques_por_dia": [
                                            {
                                                "x": "2026-10-29",
                                                "y": 41,
                                                "serie": "Cliques"
                                            }
                                        ],
                                        "bloqueios": [
                                            {
                                                "x": "Sem consentimento",
                                                "y": 61
                                            }
                                        ],
                                        "arquivo": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/marketing/campanhas/{id}/pedir-aprovacao": {
            "post": {
                "tags": [
                    "Campanhas de marketing"
                ],
                "operationId": "mktPedirAprovacao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "summary": "Request clinical approval",
                "description": "Only a draft with content and segment. Stores the content fingerprint; any later change requires a new approval. Effects: notification to the clinical board.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MktEditorCampanha"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/marketing/campanhas/{id}/pre-visualizar": {
            "post": {
                "tags": [
                    "Campanhas de marketing"
                ],
                "operationId": "mktPreVisualizar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "ver",
                "summary": "Preview (without saving)",
                "description": "Renders the message as the contact receives it, with the legal footer and unsubscribe link, from the posted draft (or the saved one).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "rascunho": {
                                        "type": "object",
                                        "properties": {
                                            "assunto": {
                                                "type": "string"
                                            },
                                            "pre_cabecalho": {
                                                "type": "string"
                                            },
                                            "blocos": {
                                                "type": "array",
                                                "items": {
                                                    "$ref": "#/components/schemas/MktBloco"
                                                }
                                            },
                                            "conteudo": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "rascunho": {
                                    "assunto": "Novidades na clínica este outono",
                                    "blocos": [
                                        {
                                            "tipo": "titulo",
                                            "texto": "Abrimos ao sábado"
                                        },
                                        {
                                            "tipo": "texto",
                                            "html": "<p>A partir de novembro, a clínica recebe consultas de avaliação ao sábado de manhã.</p>"
                                        },
                                        {
                                            "tipo": "imagem",
                                            "imagem_id": 5,
                                            "legenda": "A nossa receção"
                                        },
                                        {
                                            "tipo": "botao",
                                            "texto": "Marcar avaliação",
                                            "url": "https://clinica.exemplo.pt/marcar"
                                        },
                                        {
                                            "tipo": "divisoria"
                                        }
                                    ]
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "canal": {
                                                    "type": "string"
                                                },
                                                "html": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "texto": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "avisos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "canal": "email",
                                        "html": "<!doctype html><html>…</html>",
                                        "texto": null,
                                        "avisos": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/marketing/campanhas/{id}/teste": {
            "post": {
                "tags": [
                    "Campanhas de marketing"
                ],
                "operationId": "mktTesteCampanha",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "summary": "Send a test email to me",
                "description": "Email campaigns only; the test goes to the caller's email. Limit: 10 per 10 minutes.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "erro": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "erro": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/marketing/conversoes": {
            "get": {
                "tags": [
                    "Resultados de marketing"
                ],
                "operationId": "mktConversoes",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "ver",
                "summary": "Conversions for ad platforms",
                "description": "Leads with a click identifier that reached booked consultation, booked surgery or won, for the clinic to send back to ad platforms. Empty list when the option is off in Settings (legal basis required). No personal data: only the click identifier.",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Start"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "End"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "clique_id": {
                                                        "type": "string"
                                                    },
                                                    "conversao": {
                                                        "type": "string"
                                                    },
                                                    "origem": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "campanha": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "em": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "clique_id": "fb.1.1730100000.AbCdEf",
                                            "conversao": "consulta_marcada",
                                            "origem": "facebook",
                                            "campanha": "capilar-outono",
                                            "em": "2026-10-28T08:47:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/marketing/custos/importar": {
            "post": {
                "tags": [
                    "Resultados de marketing"
                ],
                "operationId": "mktImportarCustos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "summary": "Import ad costs (CSV)",
                "description": "CSV file («ficheiro» field, up to 5 MB, type checked from content) or the text in «csv». Required columns: plataforma, campanha, data, custo; optional: impressoes, cliques, leads. Comma or semicolon separator; comma or dot decimals. The same platform + campaign + date updates the existing row. Limit: 20 per 10 minutes.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    }
                                }
                            }
                        },
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "csv"
                                ],
                                "properties": {
                                    "csv": {
                                        "type": "string"
                                    }
                                }
                            },
                            "example": {
                                "csv": "plataforma;campanha;data;custo;impressoes;cliques;leads\nmeta;capilar-outono;2026-10-27;84,50;6100;102;3"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "importadas": {
                                                    "type": "integer"
                                                },
                                                "atualizadas": {
                                                    "type": "integer"
                                                },
                                                "erros": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "importadas": 1,
                                        "atualizadas": 0,
                                        "erros": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/marketing/integracoes": {
            "get": {
                "tags": [
                    "Resultados de marketing"
                ],
                "operationId": "mktIntegracoes",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "ver",
                "summary": "Channels and integrations",
                "description": "Status of each connection (ad leads, Instagram and Messenger, WhatsApp lines, conversions, costs, audiences, special dates, email platform, opens), what is missing in Settings, receiving addresses, latest received leads and the conversions queue. Same data as the web screen.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MktIntegracoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/marketing/integracoes/{acao}": {
            "post": {
                "tags": [
                    "Resultados de marketing"
                ],
                "operationId": "mktIntegracoesAcao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "summary": "Manual integration action",
                "description": "meta_testar, meta_subscrever (admin.definicoes edit), google_testar, leads_reprocessar (crm.leads edit), conversoes_enviar, custos_sincronizar (body: dias ≤ 90), email_sincronizar, email_testar, publico_enviar (body: id), datas_processar — the others require marketing edit. Audited. Limit: 30 per 10 minutes.",
                "parameters": [
                    {
                        "name": "acao",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "meta_testar",
                                "meta_subscrever",
                                "google_testar",
                                "leads_reprocessar",
                                "conversoes_enviar",
                                "custos_sincronizar",
                                "email_sincronizar",
                                "email_testar",
                                "publico_enviar",
                                "datas_processar"
                            ]
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "integer"
                                    },
                                    "dias": {
                                        "type": "integer"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "resultado": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "mensagem": "Aplicação subscrita em 2 de 2 páginas.",
                                        "resultado": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/marketing/publicos/{id}/exportar": {
            "get": {
                "tags": [
                    "Resultados de marketing"
                ],
                "operationId": "mktPublicoExportar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "formato",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "meta",
                                "google"
                            ]
                        },
                        "description": "File format"
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "summary": "Export an ad audience (CSV)",
                "description": "Only people with explicit marketing consent, not on the objection list; email, phone, first and last name as normalised SHA-256 hashes. Audited. Limit: 20 per 10 minutes.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "nome": {
                                                    "type": "string"
                                                },
                                                "csv": {
                                                    "type": "string"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "excluidos": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/marketing/resultados": {
            "get": {
                "tags": [
                    "Resultados de marketing"
                ],
                "operationId": "mktResultados",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "ver",
                "summary": "Costs and results per campaign",
                "description": "Matches imported spend with real leads (by campaign or utm_campaign) and with the booked consultation and surgery stages. Last 90 days by default.",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Start"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "End"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MktResultados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "de": "2026-08-01",
                                        "ate": "2026-10-28",
                                        "linhas": [
                                            {
                                                "plataforma": "meta",
                                                "plataforma_rotulo": "Meta",
                                                "campanha": "capilar-outono",
                                                "custo": 2450,
                                                "impressoes": 182000,
                                                "cliques": 3110,
                                                "leads_plataforma": 96,
                                                "leads": 88,
                                                "consultas": 21,
                                                "cirurgias": 6,
                                                "custo_por_lead": 27.84,
                                                "custo_por_consulta": 116.67,
                                                "custo_por_cirurgia": 408.33
                                            }
                                        ],
                                        "totais": {
                                            "custo": 2450,
                                            "leads": 88,
                                            "consultas": 21,
                                            "cirurgias": 6
                                        },
                                        "leads_por_origem": [
                                            {
                                                "x": "Meta (anúncios)",
                                                "y": 88,
                                                "origem": "meta"
                                            }
                                        ],
                                        "custo_por_dia": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/menu": {
            "get": {
                "tags": [
                    "Sessão"
                ],
                "operationId": "menu",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Menu filtered by permissions",
                "description": "List of groups {chave, titulo, icone, itens}. Each item: {chave, titulo, icone, url, web, rota, tipo: recurso|ecra, recurso?, app?, contador, ajuda, ativo}.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "chave": {
                                                        "type": "string"
                                                    },
                                                    "titulo": {
                                                        "type": "string"
                                                    },
                                                    "icone": {
                                                        "type": "string"
                                                    },
                                                    "itens": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object"
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/modelos-ia/estado": {
            "get": {
                "tags": [
                    "Modelos de IA"
                ],
                "operationId": "modelosIaEstado",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Status and choices per use",
                "description": "Per use: label, description, area, applicable fields, resolved values with their origin (setting | server default), switches and pode_editar. Only clinic 1 staff with Settings › Edit can change.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "areas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "string"
                                                            },
                                                            "rotulo": {
                                                                "type": "string"
                                                            },
                                                            "icone": {
                                                                "type": "string"
                                                            },
                                                            "usos": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                "usos": {
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "string"
                                                            },
                                                            "rotulo": {
                                                                "type": "string"
                                                            },
                                                            "descricao": {
                                                                "type": "string"
                                                            },
                                                            "area": {
                                                                "type": "string"
                                                            },
                                                            "visao": {
                                                                "type": "boolean"
                                                            },
                                                            "texto": {
                                                                "type": "boolean"
                                                            },
                                                            "transcricao": {
                                                                "type": "boolean"
                                                            },
                                                            "fala": {
                                                                "type": "boolean"
                                                            },
                                                            "tipos": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "visao",
                                                                        "texto",
                                                                        "transcricao",
                                                                        "fala"
                                                                    ]
                                                                }
                                                            },
                                                            "campos": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "ollama_visao": {
                                                                "type": "object"
                                                            },
                                                            "ollama_texto": {
                                                                "type": "object"
                                                            },
                                                            "ollama_transcricao": {
                                                                "type": "object"
                                                            },
                                                            "ollama_fala": {
                                                                "type": "object"
                                                            },
                                                            "openrouter_modelos": {
                                                                "type": "object"
                                                            },
                                                            "openrouter_transcricao": {
                                                                "type": "object"
                                                            },
                                                            "openrouter_fala": {
                                                                "type": "object"
                                                            },
                                                            "vozes": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ],
                                                                "description": "{ollama: {language: voice}, openrouter: {language: voice}}"
                                                            },
                                                            "fala_linguas": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ],
                                                                "description": "Languages the local speech model serves: {definido, efetivo, origem, omissao}."
                                                            },
                                                            "linguas_voz": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "ollama_ativo": {
                                                                "type": "object"
                                                            },
                                                            "openrouter_ativo": {
                                                                "type": "object"
                                                            },
                                                            "openrouter_dados": {
                                                                "type": "object"
                                                            },
                                                            "configurado": {
                                                                "type": "boolean"
                                                            },
                                                            "configurado_tipos": {
                                                                "type": "object",
                                                                "additionalProperties": {
                                                                    "type": "boolean"
                                                                }
                                                            },
                                                            "pode_editar": {
                                                                "type": "boolean"
                                                            }
                                                        }
                                                    }
                                                },
                                                "tem_chave_openrouter": {
                                                    "type": "boolean"
                                                },
                                                "max_openrouter": {
                                                    "type": "integer"
                                                },
                                                "host_local": {
                                                    "type": "boolean"
                                                },
                                                "editavel": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/modelos-ia/guardar": {
            "post": {
                "tags": [
                    "Modelos de IA"
                ],
                "operationId": "modelosIaGuardar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Save choices for a use",
                "description": "Unknown use → 422. Only the fields applicable to the use are accepted.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "uso": {
                                        "type": "string"
                                    },
                                    "ollama_visao": {
                                        "type": "string"
                                    },
                                    "ollama_texto": {
                                        "type": "string"
                                    },
                                    "ollama_transcricao": {
                                        "type": "string"
                                    },
                                    "ollama_fala": {
                                        "type": "string"
                                    },
                                    "ollama_imagem": {
                                        "type": "string"
                                    },
                                    "openrouter": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "openrouter_transcricao": {
                                        "type": "string"
                                    },
                                    "openrouter_fala": {
                                        "type": "string"
                                    },
                                    "openrouter_imagem": {
                                        "type": "string"
                                    },
                                    "vozes": {
                                        "type": "object",
                                        "description": "{ollama: {language: voice}, openrouter: {language: voice}}; languages like «pt-PT» or «en»."
                                    },
                                    "fala_linguas": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "Languages the local speech model serves (without them, local speech is not used)."
                                    },
                                    "ollama_ativo": {
                                        "type": "boolean"
                                    },
                                    "openrouter_ativo": {
                                        "type": "boolean"
                                    },
                                    "openrouter_dados": {
                                        "type": "boolean",
                                        "description": "Allows sending patient data (including voice, in voice uses) to the external service for this use."
                                    }
                                },
                                "required": [
                                    "uso"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "rotulo": {
                                                    "type": "string"
                                                },
                                                "descricao": {
                                                    "type": "string"
                                                },
                                                "area": {
                                                    "type": "string"
                                                },
                                                "visao": {
                                                    "type": "boolean"
                                                },
                                                "texto": {
                                                    "type": "boolean"
                                                },
                                                "transcricao": {
                                                    "type": "boolean"
                                                },
                                                "fala": {
                                                    "type": "boolean"
                                                },
                                                "tipos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "enum": [
                                                            "visao",
                                                            "texto",
                                                            "transcricao",
                                                            "fala"
                                                        ]
                                                    }
                                                },
                                                "campos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "ollama_visao": {
                                                    "type": "object"
                                                },
                                                "ollama_texto": {
                                                    "type": "object"
                                                },
                                                "ollama_transcricao": {
                                                    "type": "object"
                                                },
                                                "ollama_fala": {
                                                    "type": "object"
                                                },
                                                "openrouter_modelos": {
                                                    "type": "object"
                                                },
                                                "openrouter_transcricao": {
                                                    "type": "object"
                                                },
                                                "openrouter_fala": {
                                                    "type": "object"
                                                },
                                                "vozes": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "description": "{ollama: {language: voice}, openrouter: {language: voice}}"
                                                },
                                                "fala_linguas": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "description": "Languages the local speech model serves: {definido, efetivo, origem, omissao}."
                                                },
                                                "linguas_voz": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "ollama_ativo": {
                                                    "type": "object"
                                                },
                                                "openrouter_ativo": {
                                                    "type": "object"
                                                },
                                                "openrouter_dados": {
                                                    "type": "object"
                                                },
                                                "configurado": {
                                                    "type": "boolean"
                                                },
                                                "configurado_tipos": {
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "boolean"
                                                    }
                                                },
                                                "pode_editar": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/modelos-ia/ollama": {
            "get": {
                "tags": [
                    "Modelos de IA"
                ],
                "operationId": "modelosIaLocais",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Models installed on the local service",
                "parameters": [
                    {
                        "name": "renovar",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/modelos-ia/openrouter": {
            "get": {
                "tags": [
                    "Modelos de IA"
                ],
                "operationId": "modelosIaExternos",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Models available on the external service",
                "description": "Without «tipo», the text models (price per million tokens, images); with tipo=transcricao or tipo=fala, the audio models (with voices, when the catalogue lists them); with tipo=imagem, the models with image output (output_modalities=image).",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limite",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "renovar",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        }
                    },
                    {
                        "name": "tipo",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "transcricao",
                                "fala",
                                "imagem"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/modelos-ia/repor": {
            "post": {
                "tags": [
                    "Modelos de IA"
                ],
                "operationId": "modelosIaRepor",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Reset a field to the server value",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "uso": {
                                        "type": "string"
                                    },
                                    "campo": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "uso",
                                    "campo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "rotulo": {
                                                    "type": "string"
                                                },
                                                "descricao": {
                                                    "type": "string"
                                                },
                                                "area": {
                                                    "type": "string"
                                                },
                                                "visao": {
                                                    "type": "boolean"
                                                },
                                                "texto": {
                                                    "type": "boolean"
                                                },
                                                "transcricao": {
                                                    "type": "boolean"
                                                },
                                                "fala": {
                                                    "type": "boolean"
                                                },
                                                "tipos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "enum": [
                                                            "visao",
                                                            "texto",
                                                            "transcricao",
                                                            "fala"
                                                        ]
                                                    }
                                                },
                                                "campos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "ollama_visao": {
                                                    "type": "object"
                                                },
                                                "ollama_texto": {
                                                    "type": "object"
                                                },
                                                "ollama_transcricao": {
                                                    "type": "object"
                                                },
                                                "ollama_fala": {
                                                    "type": "object"
                                                },
                                                "openrouter_modelos": {
                                                    "type": "object"
                                                },
                                                "openrouter_transcricao": {
                                                    "type": "object"
                                                },
                                                "openrouter_fala": {
                                                    "type": "object"
                                                },
                                                "vozes": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "description": "{ollama: {language: voice}, openrouter: {language: voice}}"
                                                },
                                                "fala_linguas": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "description": "Languages the local speech model serves: {definido, efetivo, origem, omissao}."
                                                },
                                                "linguas_voz": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "ollama_ativo": {
                                                    "type": "object"
                                                },
                                                "openrouter_ativo": {
                                                    "type": "object"
                                                },
                                                "openrouter_dados": {
                                                    "type": "object"
                                                },
                                                "configurado": {
                                                    "type": "boolean"
                                                },
                                                "configurado_tipos": {
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "boolean"
                                                    }
                                                },
                                                "pode_editar": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/modelos-ia/testar": {
            "post": {
                "tags": [
                    "Modelos de IA"
                ],
                "operationId": "modelosIaTestar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Test a model",
                "description": "For speech targets, says the test phrase in the requested language (with the given voice or the Settings one) and, if the use has a transcription model, listens to it back; for transcription targets, listens to the phrase said by the use speech model; for image targets, generates a 256 px blue square. Tests carry no patient data.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "uso": {
                                        "type": "string"
                                    },
                                    "alvo": {
                                        "type": "string",
                                        "enum": [
                                            "ollama_visao",
                                            "ollama_texto",
                                            "ollama_transcricao",
                                            "ollama_fala",
                                            "ollama_imagem",
                                            "openrouter",
                                            "openrouter_transcricao",
                                            "openrouter_fala",
                                            "openrouter_imagem"
                                        ]
                                    },
                                    "modelo": {
                                        "type": "string"
                                    },
                                    "lingua": {
                                        "type": "string"
                                    },
                                    "voz": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "uso",
                                    "alvo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "alvo": {
                                                    "type": "string"
                                                },
                                                "modelo": {
                                                    "type": "string"
                                                },
                                                "duracao_ms": {
                                                    "type": "integer"
                                                },
                                                "resposta": {
                                                    "type": "string"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/modelos3d/incorporacoes": {
            "get": {
                "tags": [
                    "Visualizador 3D"
                ],
                "operationId": "listarIncorporacoes3d",
                "summary": "Active embed codes of the integration",
                "description": "Without the code (only its hash is stored).",
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "modelo3d_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Incorporacao3d"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/modelos3d/incorporacoes/{id}": {
            "get": {
                "tags": [
                    "Visualizador 3D"
                ],
                "operationId": "obterIncorporacao3d",
                "summary": "Embed code state (views, validity)",
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 33,
                        "description": "Embed identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Incorporacao3d"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Visualizador 3D"
                ],
                "operationId": "revogarIncorporacao3d",
                "summary": "Revoke the embed code",
                "description": "Also revokes the temporary model share; the page then answers 410.",
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 33,
                        "description": "Embed identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Incorporacao3d"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/modelos3d/{id}/incorporacao": {
            "post": {
                "tags": [
                    "Visualizador 3D"
                ],
                "operationId": "criarIncorporacao3d",
                "summary": "Request the embed code for a 3D model",
                "description": "Integration clients only (team and patient tokens get 403). Requested «origens» must be among the integration's authorised origins; without «origens», all authorised origins apply. No authorised origins → 422.",
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 33,
                        "description": "3D model identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "minutos": {
                                        "type": "integer",
                                        "minimum": 5,
                                        "maximum": 240,
                                        "description": "Link validity."
                                    },
                                    "sem_rosto": {
                                        "type": "boolean",
                                        "default": true,
                                        "description": "Remove the face from the shown mesh."
                                    },
                                    "origens": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "description": "Subset of the authorised origins."
                                    },
                                    "referencia": {
                                        "type": "string",
                                        "maxLength": 120,
                                        "description": "Free reference from your system (no personal data)."
                                    }
                                }
                            },
                            "example": {
                                "minutos": 120,
                                "origens": [
                                    "https://parceiro.exemplo.com"
                                ],
                                "referencia": "consulta-remota-881"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Incorporacao3d"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 7,
                                        "modelo3d_id": 33,
                                        "url": "https://clinica.exemplo.pt/incorporar/m3d/3f1c…",
                                        "codigo_incorporacao": "<iframe src=\"https://clinica.exemplo.pt/incorporar/m3d/3f1c…\" title=\"Modelo 3D\" width=\"100%\" height=\"560\" loading=\"lazy\" referrerpolicy=\"no-referrer\" allow=\"fullscreen\" style=\"border:0;border-radius:16px\"></iframe>",
                                        "origens": [
                                            "https://parceiro.exemplo.com"
                                        ],
                                        "expira_em": "2026-10-29T16:30:00+00:00",
                                        "minutos": 120,
                                        "sem_rosto": true,
                                        "referencia": "consulta-remota-881"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    },
                    "503": {
                        "description": "3D model sharing unavailable"
                    }
                }
            }
        },
        "/motor/afinacao": {
            "get": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "afinacaoMotor",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "ver",
                "summary": "Planned vs actual per zone and parameter suggestions",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "From"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "To"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/motor/afinacao/aplicar": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "aplicarAfinacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "summary": "Apply suggestions to the parameter draft",
                "description": "Only suggestions with enough cases; written to the latest draft. The current version only changes with clinical board approval.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "chaves": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "enum": [
                                                "area_erro_pct",
                                                "sobrevivencia_couro_pct",
                                                "cabelos_por_uf"
                                            ]
                                        }
                                    },
                                    "de": {
                                        "type": "string"
                                    },
                                    "ate": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "chaves"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "versao_id": {
                                                    "type": "integer"
                                                },
                                                "aplicadas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/motor/catalogo": {
            "get": {
                "tags": [
                    "Motor de cálculo"
                ],
                "operationId": "catalogoMotor",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "ver",
                "summary": "Parameter catalogue (section 5)",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/motor/experimentar": {
            "post": {
                "tags": [
                    "Motor de cálculo"
                ],
                "operationId": "experimentarMotor",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "ver",
                "summary": "Analysis example with a version",
                "description": "With the initial suggestions it gives 5,625 / 50 FU/cm² / 4,750 / 2,850 / 1,900 / −875.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "versao_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "versao_id": 1
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "versao": {
                                                    "type": "object"
                                                },
                                                "resultado": {
                                                    "$ref": "#/components/schemas/ResultadoMotor"
                                                },
                                                "resumo": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/motor/versoes": {
            "get": {
                "tags": [
                    "Motor de cálculo"
                ],
                "operationId": "listarVersoesMotor",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "ver",
                "summary": "Parameter versions",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/VersaoMotorLinha"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "vigente_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "pode_aprovar": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "tags": [
                    "Motor de cálculo"
                ],
                "operationId": "novoRascunhoMotor",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "summary": "New draft",
                "description": "From a version (base_id), the version in force or the analysis initial suggestions.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "base_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "notas": {
                                        "type": "string"
                                    }
                                }
                            },
                            "example": {
                                "base_id": 3
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/VersaoMotor"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/motor/versoes/{id}": {
            "get": {
                "tags": [
                    "Motor de cálculo"
                ],
                "operationId": "obterVersaoMotor",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "ver",
                "summary": "Full version (table, scenarios, zone × grade table, differences)",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/VersaoMotor"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "put": {
                "tags": [
                    "Motor de cálculo"
                ],
                "operationId": "gravarVersaoMotor",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "summary": "Save the draft",
                "description": "Drafts only. Each parameter's unit is the catalogue's (another → 422).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "parametros": {
                                        "type": "object"
                                    },
                                    "notas": {
                                        "type": "string"
                                    },
                                    "finalidade_regulamentar": {
                                        "type": "string"
                                    }
                                }
                            },
                            "example": {
                                "parametros": {
                                    "valores": {
                                        "dens_coroa": {
                                            "valor": 22
                                        }
                                    },
                                    "cenarios": {
                                        "agressivo": {
                                            "extracao_sessao_pct": 30
                                        }
                                    }
                                },
                                "finalidade_regulamentar": "Apoio ao médico…"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/VersaoMotor"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/motor/versoes/{id}/aprovar": {
            "post": {
                "tags": [
                    "Motor de cálculo"
                ],
                "operationId": "aprovarVersaoMotor",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "aprovar",
                "summary": "Approve (clinical board only)",
                "description": "Requires a doctor with direcao_clinica = 1 and «approve» on clinico.parametros, and a written regulatory purpose. The previous version in force is archived. Effects: notification to doctors, motor.versao_aprovada webhook.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/VersaoMotor"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/motor/versoes/{id}/arquivar": {
            "post": {
                "tags": [
                    "Motor de cálculo"
                ],
                "operationId": "arquivarVersaoMotor",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "summary": "Archive",
                "description": "Withdrawing the version in force requires the clinical board.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/VersaoMotor"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/notificacoes": {
            "get": {
                "tags": [
                    "Sessão"
                ],
                "operationId": "notificacoes",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Notifications",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "por_ler",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "tipo": {
                                                        "type": "string"
                                                    },
                                                    "titulo": {
                                                        "type": "string"
                                                    },
                                                    "corpo": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "ligacao": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "lida": {
                                                        "type": "boolean"
                                                    },
                                                    "lida_em": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "criado_em": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "pagina": {
                                                    "type": "integer"
                                                },
                                                "por_pagina": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "por_ler": {
                                                    "type": "integer"
                                                },
                                                "nao_lidas": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/notificacoes/lidas": {
            "post": {
                "tags": [
                    "Sessão"
                ],
                "operationId": "marcarTodasLidas",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Mark all as read",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "marcadas": {
                                                    "type": "integer"
                                                },
                                                "por_ler": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/notificacoes/preferencias": {
            "get": {
                "tags": [
                    "Avisos no telemóvel"
                ],
                "operationId": "notificacoesPreferencias",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Preferences per category",
                "description": "Team: messages, schedule, tasks, documents, payments, alerts, general. Patients: messages, schedule, documents, payments, general. No choice = on.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "chave": {
                                                        "type": "string",
                                                        "enum": [
                                                            "mensagens",
                                                            "agenda",
                                                            "tarefas",
                                                            "documentos",
                                                            "pagamentos",
                                                            "alertas",
                                                            "geral"
                                                        ]
                                                    },
                                                    "rotulo": {
                                                        "type": "string"
                                                    },
                                                    "descricao": {
                                                        "type": "string"
                                                    },
                                                    "push": {
                                                        "type": "boolean"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "chave": "mensagens",
                                            "rotulo": "Mensagens",
                                            "descricao": "Mensagens de pacientes e da equipa, menções e comunicados.",
                                            "push": true
                                        },
                                        {
                                            "chave": "agenda",
                                            "rotulo": "Agenda e marcações",
                                            "descricao": "Marcações, teleconsultas, bloco operatório e reuniões.",
                                            "push": false
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "put": {
                "tags": [
                    "Avisos no telemóvel"
                ],
                "operationId": "notificacoesPreferenciasGravar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Save preferences",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "categorias": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "boolean"
                                        }
                                    },
                                    "categoria": {
                                        "type": "string"
                                    },
                                    "push": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "categorias": {
                                    "agenda": false,
                                    "mensagens": true
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "chave": {
                                                        "type": "string",
                                                        "enum": [
                                                            "mensagens",
                                                            "agenda",
                                                            "tarefas",
                                                            "documentos",
                                                            "pagamentos",
                                                            "alertas",
                                                            "geral"
                                                        ]
                                                    },
                                                    "rotulo": {
                                                        "type": "string"
                                                    },
                                                    "descricao": {
                                                        "type": "string"
                                                    },
                                                    "push": {
                                                        "type": "boolean"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "chave": "mensagens",
                                            "rotulo": "Mensagens",
                                            "descricao": "Mensagens de pacientes e da equipa, menções e comunicados.",
                                            "push": true
                                        },
                                        {
                                            "chave": "agenda",
                                            "rotulo": "Agenda e marcações",
                                            "descricao": "Marcações, teleconsultas, bloco operatório e reuniões.",
                                            "push": false
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/notificacoes/{id}/lida": {
            "post": {
                "tags": [
                    "Sessão"
                ],
                "operationId": "marcarNotificacaoLida",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "summary": "Mark as read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "por_ler": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/oauth/token": {
            "post": {
                "tags": [
                    "Integrações"
                ],
                "operationId": "tokenIntegracao",
                "security": [],
                "summary": "Integration token (client credentials)",
                "description": "RFC 6749 §4.4. Credentials in the body (client_id, client_secret) or HTTP Basic. Standard OAuth response OUTSIDE the envelope. The token is valid for 1 hour; there is no refresh: request a new one. Scopes with clinical content are only granted after the client clinical justification is approved.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "grant_type"
                                ],
                                "properties": {
                                    "grant_type": {
                                        "const": "client_credentials"
                                    },
                                    "client_id": {
                                        "type": "string"
                                    },
                                    "client_secret": {
                                        "type": "string"
                                    },
                                    "scope": {
                                        "type": "string",
                                        "description": "Space-separated scopes (subset of those granted)."
                                    }
                                }
                            }
                        },
                        "application/json": {
                            "schema": {
                                "type": "object"
                            },
                            "example": {
                                "grant_type": "client_credentials",
                                "client_id": "ax_4f1d0c9b2e7a6f3d8c5b1a20",
                                "client_secret": "…",
                                "scope": "agenda:ver crm.leads:editar"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Token issued",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "access_token": {
                                            "type": "string"
                                        },
                                        "token_type": {
                                            "const": "Bearer"
                                        },
                                        "expires_in": {
                                            "type": "integer"
                                        },
                                        "scope": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "example": {
                                    "access_token": "ax_i_…",
                                    "token_type": "Bearer",
                                    "expires_in": 3600,
                                    "scope": "agenda:ver crm.leads:editar"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "invalid_request | unsupported_grant_type | invalid_scope",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_description": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_client (wrong credentials, inactive or expired client, address not allowed)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_description": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/opcoes/academia_certificados": {
            "get": {
                "tags": [
                    "Recurso: Certificates"
                ],
                "operationId": "opcoesAcademiaCertificados",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_certificados"
            }
        },
        "/opcoes/academia_cursos": {
            "get": {
                "tags": [
                    "Recurso: Academy courses"
                ],
                "operationId": "opcoesAcademiaCursos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_cursos"
            }
        },
        "/opcoes/academia_licoes": {
            "get": {
                "tags": [
                    "Recurso: Lessons"
                ],
                "operationId": "opcoesAcademiaLicoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_licoes"
            }
        },
        "/opcoes/academia_percursos": {
            "get": {
                "tags": [
                    "Recurso: Training paths"
                ],
                "operationId": "opcoesAcademiaPercursos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_percursos"
            }
        },
        "/opcoes/academia_perguntas": {
            "get": {
                "tags": [
                    "Recurso: Test questions"
                ],
                "operationId": "opcoesAcademiaPerguntas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_perguntas"
            }
        },
        "/opcoes/acessos_emergencia": {
            "get": {
                "tags": [
                    "Recurso: Emergency access"
                ],
                "operationId": "opcoesAcessosEmergencia",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "acessos_emergencia"
            }
        },
        "/opcoes/agente_pedidos": {
            "get": {
                "tags": [
                    "Recurso: Agent requests"
                ],
                "operationId": "opcoesAgentePedidos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "agente_pedidos"
            }
        },
        "/opcoes/agente_testes": {
            "get": {
                "tags": [
                    "Recurso: Test conversations"
                ],
                "operationId": "opcoesAgenteTestes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "agente_testes"
            }
        },
        "/opcoes/alertas_acesso": {
            "get": {
                "tags": [
                    "Recurso: Access alerts"
                ],
                "operationId": "opcoesAlertasAcesso",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "alertas_acesso"
            }
        },
        "/opcoes/api_clientes": {
            "get": {
                "tags": [
                    "Recurso: Integration clients"
                ],
                "operationId": "opcoesApiClientes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "api_clientes"
            }
        },
        "/opcoes/artigos": {
            "get": {
                "tags": [
                    "Recurso: Items"
                ],
                "operationId": "opcoesArtigos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "artigos"
            }
        },
        "/opcoes/artigos_precos": {
            "get": {
                "tags": [
                    "Recurso: Supplier prices"
                ],
                "operationId": "opcoesArtigosPrecos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "artigos_precos"
            }
        },
        "/opcoes/atividades_tratamento": {
            "get": {
                "tags": [
                    "Recurso: Record of processing activities"
                ],
                "operationId": "opcoesAtividadesTratamento",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "atividades_tratamento"
            }
        },
        "/opcoes/ausencias": {
            "get": {
                "tags": [
                    "Recurso: Absences and holidays"
                ],
                "operationId": "opcoesAusencias",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ausencias"
            }
        },
        "/opcoes/avisos_exibicoes": {
            "get": {
                "tags": [
                    "Recurso: Notices shown"
                ],
                "operationId": "opcoesAvisosExibicoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "avisos_exibicoes"
            }
        },
        "/opcoes/avisos_privacidade": {
            "get": {
                "tags": [
                    "Recurso: Privacy notices"
                ],
                "operationId": "opcoesAvisosPrivacidade",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "avisos_privacidade"
            }
        },
        "/opcoes/base_conhecimento": {
            "get": {
                "tags": [
                    "Recurso: Knowledge base"
                ],
                "operationId": "opcoesBaseConhecimento",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "base_conhecimento"
            }
        },
        "/opcoes/caixas": {
            "get": {
                "tags": [
                    "Recurso: Tills"
                ],
                "operationId": "opcoesCaixas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "caixas"
            }
        },
        "/opcoes/campanhas": {
            "get": {
                "tags": [
                    "Recurso: Campaigns"
                ],
                "operationId": "opcoesCampanhas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "campanhas"
            }
        },
        "/opcoes/campanhas_chamadas": {
            "get": {
                "tags": [
                    "Recurso: Call lists"
                ],
                "operationId": "opcoesCampanhasChamadas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "campanhas_chamadas"
            }
        },
        "/opcoes/capturas": {
            "get": {
                "tags": [
                    "Recurso: Captures"
                ],
                "operationId": "opcoesCapturas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "capturas"
            }
        },
        "/opcoes/casos_publicados": {
            "get": {
                "tags": [
                    "Recurso: Published cases"
                ],
                "operationId": "opcoesCasosPublicados",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "casos_publicados"
            }
        },
        "/opcoes/chamadas": {
            "get": {
                "tags": [
                    "Recurso: Calls"
                ],
                "operationId": "opcoesChamadas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "chamadas"
            }
        },
        "/opcoes/checklist_modelos": {
            "get": {
                "tags": [
                    "Recurso: Safety checklists"
                ],
                "operationId": "opcoesChecklistModelos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.registo:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "checklist_modelos"
            }
        },
        "/opcoes/cirurgias": {
            "get": {
                "tags": [
                    "Recurso: Surgeries"
                ],
                "operationId": "opcoesCirurgias",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.mapa:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "bloco.mapa",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cirurgias"
            }
        },
        "/opcoes/clinicas": {
            "get": {
                "tags": [
                    "Recurso: Clinics"
                ],
                "operationId": "opcoesClinicas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "clinicas"
            }
        },
        "/opcoes/cms_blocos": {
            "get": {
                "tags": [
                    "Recurso: Website blocks"
                ],
                "operationId": "opcoesCmsBlocos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cms_blocos"
            }
        },
        "/opcoes/cms_paginas": {
            "get": {
                "tags": [
                    "Recurso: Website pages"
                ],
                "operationId": "opcoesCmsPaginas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cms_paginas"
            }
        },
        "/opcoes/codigos_desconto": {
            "get": {
                "tags": [
                    "Recurso: Discount codes"
                ],
                "operationId": "opcoesCodigosDesconto",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.descontos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.descontos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "codigos_desconto"
            }
        },
        "/opcoes/comissoes": {
            "get": {
                "tags": [
                    "Recurso: Commissions"
                ],
                "operationId": "opcoesComissoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comissoes"
            }
        },
        "/opcoes/comissoes_regras": {
            "get": {
                "tags": [
                    "Recurso: Commission rules"
                ],
                "operationId": "opcoesComissoesRegras",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comissoes_regras"
            }
        },
        "/opcoes/complicacoes": {
            "get": {
                "tags": [
                    "Recurso: Complications"
                ],
                "operationId": "opcoesComplicacoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "complicacoes"
            }
        },
        "/opcoes/comunicados": {
            "get": {
                "tags": [
                    "Recurso: Announcements"
                ],
                "operationId": "opcoesComunicados",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comunicados"
            }
        },
        "/opcoes/consentimento_modelos": {
            "get": {
                "tags": [
                    "Recurso: Consent templates"
                ],
                "operationId": "opcoesConsentimentoModelos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consentimento_modelos"
            }
        },
        "/opcoes/consentimentos": {
            "get": {
                "tags": [
                    "Recurso: Consent register"
                ],
                "operationId": "opcoesConsentimentos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consentimentos"
            }
        },
        "/opcoes/conservacao_regras": {
            "get": {
                "tags": [
                    "Recurso: Retention periods"
                ],
                "operationId": "opcoesConservacaoRegras",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "conservacao_regras"
            }
        },
        "/opcoes/consultas": {
            "get": {
                "tags": [
                    "Recurso: Consultations"
                ],
                "operationId": "opcoesConsultas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consultas"
            }
        },
        "/opcoes/contas_pagadoras": {
            "get": {
                "tags": [
                    "Recurso: Paying accounts"
                ],
                "operationId": "opcoesContasPagadoras",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "contas_pagadoras"
            }
        },
        "/opcoes/contas_subcontas": {
            "get": {
                "tags": [
                    "Recurso: Sub-accounts"
                ],
                "operationId": "opcoesContasSubcontas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "contas_subcontas"
            }
        },
        "/opcoes/convencoes": {
            "get": {
                "tags": [
                    "Recurso: Agreements"
                ],
                "operationId": "opcoesConvencoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "convencoes"
            }
        },
        "/opcoes/convencoes_atos": {
            "get": {
                "tags": [
                    "Recurso: Agreement procedures"
                ],
                "operationId": "opcoesConvencoesAtos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "convencoes_atos"
            }
        },
        "/opcoes/conversas": {
            "get": {
                "tags": [
                    "Recurso: Conversations"
                ],
                "operationId": "opcoesConversas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "conversas"
            }
        },
        "/opcoes/cuidados_conteudos": {
            "get": {
                "tags": [
                    "Recurso: Care by stage"
                ],
                "operationId": "opcoesCuidadosConteudos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cuidados_conteudos"
            }
        },
        "/opcoes/custos_anuncios": {
            "get": {
                "tags": [
                    "Recurso: Ad costs"
                ],
                "operationId": "opcoesCustosAnuncios",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "custos_anuncios"
            }
        },
        "/opcoes/datas_especiais": {
            "get": {
                "tags": [
                    "Recurso: Special dates"
                ],
                "operationId": "opcoesDatasEspeciais",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "datas_especiais"
            }
        },
        "/opcoes/delegacoes": {
            "get": {
                "tags": [
                    "Recurso: Delegations"
                ],
                "operationId": "opcoesDelegacoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "delegacoes"
            }
        },
        "/opcoes/diagnosticos_apoio": {
            "get": {
                "tags": [
                    "Recurso: Support diagnoses"
                ],
                "operationId": "opcoesDiagnosticosApoio",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "diagnosticos_apoio"
            }
        },
        "/opcoes/documento_modelos": {
            "get": {
                "tags": [
                    "Recurso: Document templates"
                ],
                "operationId": "opcoesDocumentoModelos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documento_modelos"
            }
        },
        "/opcoes/documentos": {
            "get": {
                "tags": [
                    "Recurso: Issued documents"
                ],
                "operationId": "opcoesDocumentos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documentos"
            }
        },
        "/opcoes/documentos_fiscais": {
            "get": {
                "tags": [
                    "Recurso: Tax documents"
                ],
                "operationId": "opcoesDocumentosFiscais",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documentos_fiscais"
            }
        },
        "/opcoes/encomendas": {
            "get": {
                "tags": [
                    "Recurso: Orders"
                ],
                "operationId": "opcoesEncomendas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "encomendas"
            }
        },
        "/opcoes/episodios": {
            "get": {
                "tags": [
                    "Recurso: Episodes"
                ],
                "operationId": "opcoesEpisodios",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "episodios"
            }
        },
        "/opcoes/episodios_equipa": {
            "get": {
                "tags": [
                    "Recurso: Episode teams"
                ],
                "operationId": "opcoesEpisodiosEquipa",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "episodios_equipa"
            }
        },
        "/opcoes/equipamentos": {
            "get": {
                "tags": [
                    "Recurso: Equipment"
                ],
                "operationId": "opcoesEquipamentos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipamentos"
            }
        },
        "/opcoes/equipamentos_registos": {
            "get": {
                "tags": [
                    "Recurso: Maintenance and records"
                ],
                "operationId": "opcoesEquipamentosRegistos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipamentos_registos"
            }
        },
        "/opcoes/equipas": {
            "get": {
                "tags": [
                    "Recurso: Teams"
                ],
                "operationId": "opcoesEquipas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipas"
            }
        },
        "/opcoes/feriados": {
            "get": {
                "tags": [
                    "Recurso: Public holidays"
                ],
                "operationId": "opcoesFeriados",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "feriados"
            }
        },
        "/opcoes/formacoes": {
            "get": {
                "tags": [
                    "Recurso: Team training"
                ],
                "operationId": "opcoesFormacoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formacoes"
            }
        },
        "/opcoes/formularios": {
            "get": {
                "tags": [
                    "Recurso: Forms"
                ],
                "operationId": "opcoesFormularios",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formularios"
            }
        },
        "/opcoes/formularios_respostas": {
            "get": {
                "tags": [
                    "Recurso: Form responses"
                ],
                "operationId": "opcoesFormulariosRespostas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formularios_respostas"
            }
        },
        "/opcoes/fotos": {
            "get": {
                "tags": [
                    "Recurso: Photographs"
                ],
                "operationId": "opcoesFotos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "fotos"
            }
        },
        "/opcoes/funil_fases": {
            "get": {
                "tags": [
                    "Recurso: Pipeline stages"
                ],
                "operationId": "opcoesFunilFases",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "funil_fases"
            }
        },
        "/opcoes/funis": {
            "get": {
                "tags": [
                    "Recurso: Market funnels"
                ],
                "operationId": "opcoesFunis",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "funis"
            }
        },
        "/opcoes/guioes": {
            "get": {
                "tags": [
                    "Recurso: Call scripts"
                ],
                "operationId": "opcoesGuioes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "guioes"
            }
        },
        "/opcoes/honorarios": {
            "get": {
                "tags": [
                    "Recurso: Fees"
                ],
                "operationId": "opcoesHonorarios",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "honorarios"
            }
        },
        "/opcoes/horarios": {
            "get": {
                "tags": [
                    "Recurso: Working hours"
                ],
                "operationId": "opcoesHorarios",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "horarios"
            }
        },
        "/opcoes/ia_pedidos": {
            "get": {
                "tags": [
                    "Recurso: AI requests"
                ],
                "operationId": "opcoesIaPedidos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ia_pedidos"
            }
        },
        "/opcoes/ia_propostas": {
            "get": {
                "tags": [
                    "Recurso: AI proposals"
                ],
                "operationId": "opcoesIaPropostas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ia_propostas"
            }
        },
        "/opcoes/imagens_marketing": {
            "get": {
                "tags": [
                    "Recurso: Image library"
                ],
                "operationId": "opcoesImagensMarketing",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "imagens_marketing"
            }
        },
        "/opcoes/importacoes": {
            "get": {
                "tags": [
                    "Recurso: Imports"
                ],
                "operationId": "opcoesImportacoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "importacoes"
            }
        },
        "/opcoes/incidentes_seguranca": {
            "get": {
                "tags": [
                    "Recurso: Security incidents"
                ],
                "operationId": "opcoesIncidentesSeguranca",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "incidentes_seguranca"
            }
        },
        "/opcoes/itinerarios": {
            "get": {
                "tags": [
                    "Recurso: Itineraries"
                ],
                "operationId": "opcoesItinerarios",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "itinerarios"
            }
        },
        "/opcoes/leads": {
            "get": {
                "tags": [
                    "Recurso: Leads"
                ],
                "operationId": "opcoesLeads",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "leads"
            }
        },
        "/opcoes/lista_espera": {
            "get": {
                "tags": [
                    "Recurso: Waiting list"
                ],
                "operationId": "opcoesListaEspera",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "lista_espera"
            }
        },
        "/opcoes/locais": {
            "get": {
                "tags": [
                    "Recurso: Locations"
                ],
                "operationId": "opcoesLocais",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "locais"
            }
        },
        "/opcoes/marcacao_tipos": {
            "get": {
                "tags": [
                    "Recurso: Appointment types"
                ],
                "operationId": "opcoesMarcacaoTipos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcacao_tipos"
            }
        },
        "/opcoes/marcacoes": {
            "get": {
                "tags": [
                    "Recurso: Appointments"
                ],
                "operationId": "opcoesMarcacoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcacoes"
            }
        },
        "/opcoes/marcos_acompanhamento": {
            "get": {
                "tags": [
                    "Recurso: Follow-up milestones"
                ],
                "operationId": "opcoesMarcosAcompanhamento",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcos_acompanhamento"
            }
        },
        "/opcoes/modelos3d": {
            "get": {
                "tags": [
                    "Recurso: 3D models"
                ],
                "operationId": "opcoesModelos3d",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "modelos3d"
            }
        },
        "/opcoes/motor_versoes": {
            "get": {
                "tags": [
                    "Recurso: Engine versions"
                ],
                "operationId": "opcoesMotorVersoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "motor_versoes"
            }
        },
        "/opcoes/objetivos_comerciais": {
            "get": {
                "tags": [
                    "Recurso: Sales goals"
                ],
                "operationId": "opcoesObjetivosComerciais",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "objetivos_comerciais"
            }
        },
        "/opcoes/pacientes": {
            "get": {
                "tags": [
                    "Recurso: Patients"
                ],
                "operationId": "opcoesPacientes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pacientes"
            }
        },
        "/opcoes/pacientes_alertas": {
            "get": {
                "tags": [
                    "Recurso: Clinical alerts"
                ],
                "operationId": "opcoesPacientesAlertas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pacientes_alertas"
            }
        },
        "/opcoes/pagamentos": {
            "get": {
                "tags": [
                    "Recurso: Payments"
                ],
                "operationId": "opcoesPagamentos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pagamentos"
            }
        },
        "/opcoes/parceiros": {
            "get": {
                "tags": [
                    "Recurso: Partners"
                ],
                "operationId": "opcoesParceiros",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "parceiros"
            }
        },
        "/opcoes/parceiros_encaminhamentos": {
            "get": {
                "tags": [
                    "Recurso: Partner referrals"
                ],
                "operationId": "opcoesParceirosEncaminhamentos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "parceiros_encaminhamentos"
            }
        },
        "/opcoes/pedidos_titulares": {
            "get": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "opcoesPedidosTitulares",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pedidos_titulares"
            }
        },
        "/opcoes/perfis": {
            "get": {
                "tags": [
                    "Recurso: Profiles"
                ],
                "operationId": "opcoesPerfis",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "perfis"
            }
        },
        "/opcoes/planos": {
            "get": {
                "tags": [
                    "Recurso: Surgical plans"
                ],
                "operationId": "opcoesPlanos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "planos"
            }
        },
        "/opcoes/portal_contas": {
            "get": {
                "tags": [
                    "Recurso: Portal accounts"
                ],
                "operationId": "opcoesPortalContas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "portal_contas"
            }
        },
        "/opcoes/portal_pedidos": {
            "get": {
                "tags": [
                    "Recurso: Portal requests"
                ],
                "operationId": "opcoesPortalPedidos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "portal_pedidos"
            }
        },
        "/opcoes/pre_avaliacoes": {
            "get": {
                "tags": [
                    "Recurso: Online assessments"
                ],
                "operationId": "opcoesPreAvaliacoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pre_avaliacoes"
            }
        },
        "/opcoes/procedimentos": {
            "get": {
                "tags": [
                    "Recurso: Procedures"
                ],
                "operationId": "opcoesProcedimentos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "procedimentos"
            }
        },
        "/opcoes/propostas": {
            "get": {
                "tags": [
                    "Recurso: Proposals"
                ],
                "operationId": "opcoesPropostas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "propostas"
            }
        },
        "/opcoes/protocolos_foto": {
            "get": {
                "tags": [
                    "Recurso: Photo protocols"
                ],
                "operationId": "opcoesProtocolosFoto",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "protocolos_foto"
            }
        },
        "/opcoes/publicos_anuncios": {
            "get": {
                "tags": [
                    "Recurso: Ad audiences"
                ],
                "operationId": "opcoesPublicosAnuncios",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "publicos_anuncios"
            }
        },
        "/opcoes/reclamacoes": {
            "get": {
                "tags": [
                    "Recurso: Complaints, compliments and suggestions"
                ],
                "operationId": "opcoesReclamacoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "reclamacoes"
            }
        },
        "/opcoes/recursos_agenda": {
            "get": {
                "tags": [
                    "Recurso: Rooms, equipment and interpreters"
                ],
                "operationId": "opcoesRecursosAgenda",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "recursos_agenda"
            }
        },
        "/opcoes/regras_elegibilidade": {
            "get": {
                "tags": [
                    "Recurso: Eligibility rules"
                ],
                "operationId": "opcoesRegrasElegibilidade",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "regras_elegibilidade"
            }
        },
        "/opcoes/relatorios_agendados": {
            "get": {
                "tags": [
                    "Recurso: Scheduled reports"
                ],
                "operationId": "opcoesRelatoriosAgendados",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "relatorios_agendados"
            }
        },
        "/opcoes/respostas_rapidas": {
            "get": {
                "tags": [
                    "Recurso: Quick replies"
                ],
                "operationId": "opcoesRespostasRapidas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "respostas_rapidas"
            }
        },
        "/opcoes/reunioes": {
            "get": {
                "tags": [
                    "Recurso: Meetings"
                ],
                "operationId": "opcoesReunioes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "reunioes"
            }
        },
        "/opcoes/revisoes_acessos": {
            "get": {
                "tags": [
                    "Recurso: Access reviews"
                ],
                "operationId": "opcoesRevisoesAcessos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "revisoes_acessos"
            }
        },
        "/opcoes/segmentos": {
            "get": {
                "tags": [
                    "Recurso: Segments"
                ],
                "operationId": "opcoesSegmentos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "segmentos"
            }
        },
        "/opcoes/sequencias": {
            "get": {
                "tags": [
                    "Recurso: Sequences"
                ],
                "operationId": "opcoesSequencias",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "sequencias"
            }
        },
        "/opcoes/stock_movimentos": {
            "get": {
                "tags": [
                    "Recurso: Stock movements"
                ],
                "operationId": "opcoesStockMovimentos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "stock_movimentos"
            }
        },
        "/opcoes/subcontratantes": {
            "get": {
                "tags": [
                    "Recurso: Processors"
                ],
                "operationId": "opcoesSubcontratantes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "subcontratantes"
            }
        },
        "/opcoes/supressoes": {
            "get": {
                "tags": [
                    "Recurso: Contact opt-outs"
                ],
                "operationId": "opcoesSupressoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "supressoes"
            }
        },
        "/opcoes/tabelas_precos": {
            "get": {
                "tags": [
                    "Recurso: Price lists"
                ],
                "operationId": "opcoesTabelasPrecos",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tabelas_precos"
            }
        },
        "/opcoes/tarefas": {
            "get": {
                "tags": [
                    "Recurso: Tasks"
                ],
                "operationId": "opcoesTarefas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tarefas"
            }
        },
        "/opcoes/teleconsultas": {
            "get": {
                "tags": [
                    "Recurso: Teleconsultations"
                ],
                "operationId": "opcoesTeleconsultas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "teleconsulta:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "teleconsultas"
            }
        },
        "/opcoes/telefonia_extensoes": {
            "get": {
                "tags": [
                    "Recurso: Extensions"
                ],
                "operationId": "opcoesTelefoniaExtensoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "telefonia_extensoes"
            }
        },
        "/opcoes/telefonia_numeros": {
            "get": {
                "tags": [
                    "Recurso: Clinic numbers"
                ],
                "operationId": "opcoesTelefoniaNumeros",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "telefonia_numeros"
            }
        },
        "/opcoes/terminais_pagamento": {
            "get": {
                "tags": [
                    "Recurso: Payment terminals"
                ],
                "operationId": "opcoesTerminaisPagamento",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "terminais_pagamento"
            }
        },
        "/opcoes/tratamentos_complementares": {
            "get": {
                "tags": [
                    "Recurso: Complementary treatments"
                ],
                "operationId": "opcoesTratamentosComplementares",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tratamentos_complementares"
            }
        },
        "/opcoes/tricoscopias": {
            "get": {
                "tags": [
                    "Recurso: Trichoscopy fields"
                ],
                "operationId": "opcoesTricoscopias",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tricoscopias"
            }
        },
        "/opcoes/utilizadores": {
            "get": {
                "tags": [
                    "Recurso: Users"
                ],
                "operationId": "opcoesUtilizadores",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "utilizadores"
            }
        },
        "/opcoes/vales": {
            "get": {
                "tags": [
                    "Recurso: Gift vouchers"
                ],
                "operationId": "opcoesVales",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "vales"
            }
        },
        "/opcoes/voz_gravacoes": {
            "get": {
                "tags": [
                    "Recurso: Recorded messages"
                ],
                "operationId": "opcoesVozGravacoes",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "voz_gravacoes"
            }
        },
        "/opcoes/voz_menus": {
            "get": {
                "tags": [
                    "Recurso: Voice menus"
                ],
                "operationId": "opcoesVozMenus",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "voz_menus"
            }
        },
        "/opcoes/webhooks": {
            "get": {
                "tags": [
                    "Recurso: Webhooks"
                ],
                "operationId": "opcoesWebhooks",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "webhooks"
            }
        },
        "/opcoes/webhooks_entregas": {
            "get": {
                "tags": [
                    "Recurso: Webhook deliveries"
                ],
                "operationId": "opcoesWebhooksEntregas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "webhooks_entregas"
            }
        },
        "/opcoes/whatsapp_linhas": {
            "get": {
                "tags": [
                    "Recurso: WhatsApp lines"
                ],
                "operationId": "opcoesWhatsappLinhas",
                "summary": "Options for pickers (id, label)",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1,2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Opcao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "whatsapp_linhas"
            }
        },
        "/openapi.json": {
            "get": {
                "tags": [
                    "Integrações"
                ],
                "operationId": "especificacaoJson",
                "security": [],
                "summary": "OpenAPI 3.1 specification (JSON)",
                "parameters": [
                    {
                        "name": "lingua",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pt",
                                "en"
                            ]
                        }
                    },
                    {
                        "name": "descarregar",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OpenAPI document",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/openapi.yaml": {
            "get": {
                "tags": [
                    "Integrações"
                ],
                "operationId": "especificacaoYaml",
                "security": [],
                "summary": "OpenAPI 3.1 specification (YAML)",
                "parameters": [
                    {
                        "name": "lingua",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pt",
                                "en"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OpenAPI document",
                        "content": {
                            "application/yaml": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/pacientes/duplicados": {
            "post": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1VerificarDuplicados",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "ver",
                "summary": "Possible duplicates of data not yet saved",
                "description": "The route has no permission of its own: the controller requires «view» on ficha.identificacao OR on crm.leads (sales check before converting a lead). Team and integrations. Same criteria and output as GET /pacientes/{id}/duplicados; excluir_id removes one patient from the comparison. Stores nothing. Limit (default): 120 requests per minute per team token; integrations use the per-minute limit set on the integration client (429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string"
                                    },
                                    "apelidos": {
                                        "type": "string"
                                    },
                                    "nome_completo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Used instead of first name + surnames when sent."
                                    },
                                    "email": {
                                        "type": "string"
                                    },
                                    "telefone": {
                                        "type": "string",
                                        "description": "Compares the last 9 digits."
                                    },
                                    "nif": {
                                        "type": "string",
                                        "description": "Compared by blind index (6 or more digits)."
                                    },
                                    "data_nascimento": {
                                        "type": "string"
                                    },
                                    "excluir_id": {
                                        "type": "integer"
                                    }
                                }
                            },
                            "example": {
                                "nome": "Rui",
                                "apelidos": "Almeida",
                                "email": "rui.almeida@exemplo.pt",
                                "telefone": "912 345 678",
                                "data_nascimento": "1988-04-12"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M1Duplicado"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/pacientes/importar": {
            "post": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1ImportarPacientes",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "summary": "Import patient records (CSV)",
                "description": "Two steps: gravar = 0 previews (each row validated and compared with existing patients), gravar = 1 imports. .csv or .txt text file, up to 5 MB and 5000 rows, «;», «,» or tab separator (detected), UTF-8 or Latin-1 (cp1252, converted); read and discarded, never stored. Accepted headers, accent- and case-insensitive, with synonyms: nome, apelidos, nome completo, email, telefone, telefone alternativo, data de nascimento, sexo, nif, morada, codigo postal, localidade, pais, nacionalidade, idioma, profissao, cliente desde, notas, numero anterior (goes into the notes). A name column is required. Strong duplicates are left out; invalid rows end up as «erro» with the messages. Effects when importing: patients with the clinic number and «importacao» source, timeline and paciente.criado webhook per patient, audit. History (compatible addition, «tipo» field): pacientes (default), consultas, alertas or episodios. Each history row identifies the patient by one column: numero paciente (current record), numero anterior (the old system number recorded when importing patients), nif, email or full name + date of birth (only with a single strong candidate). Consultations (date column required; type, reason, history, medication, allergies, habits, family history, expectations, examination, diagnosis, differential diagnosis, notes, scale, grade, technique, area): require ficha.clinica edit and the patient in clinical scope; they come in CLOSED («assinada» status, «importacao» source, fingerprint, addendum with the provenance); duplicate = same patient, day and type. Alerts (description required; type, severity): ficha.clinica edit; they come in AWAITING VALIDATION; duplicate = same type and description. Episodes (title required; technique, area, status, start, end): identification or clinical record edit; no tasks nor webhooks; duplicate = same title and start day. With gravar = 1 a row is kept in the «importacoes» resource (per-row report without names nor clinical content) and the response carries importacao_id. History rows carry «paciente» {id, numero} instead of the name. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After). Additional limit: 20 requests per 10 minutes per IP address (only data-changing requests count).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "Text CSV (.csv or .txt)"
                                    },
                                    "gravar": {
                                        "type": "string",
                                        "enum": [
                                            "0",
                                            "1",
                                            "true",
                                            "sim"
                                        ],
                                        "default": "0"
                                    },
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "pacientes",
                                            "consultas",
                                            "alertas",
                                            "episodios"
                                        ],
                                        "default": "pacientes"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1Importacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "tipo": "pacientes",
                                        "colunas": {
                                            "Nome": "nome",
                                            "Apelidos": "apelidos",
                                            "E-mail": "email",
                                            "Telemóvel": "telefone",
                                            "Nascimento": "data_nascimento"
                                        },
                                        "linhas": [
                                            {
                                                "linha": 2,
                                                "nome": "Ana Sousa",
                                                "estado": "novo",
                                                "mensagens": [],
                                                "duplicado_de": null,
                                                "id": null,
                                                "paciente": null
                                            },
                                            {
                                                "linha": 3,
                                                "nome": "Rui Almeida",
                                                "estado": "duplicado",
                                                "mensagens": [
                                                    "Já existe: P-2026-0311"
                                                ],
                                                "duplicado_de": {
                                                    "id": 1204,
                                                    "numero": "P-2026-0311",
                                                    "nome": "Rui Almeida"
                                                },
                                                "id": null,
                                                "paciente": null
                                            }
                                        ],
                                        "resumo": {
                                            "total": 2,
                                            "novos": 1,
                                            "duplicados": 1,
                                            "erros": 0,
                                            "importados": 0
                                        },
                                        "importacao_id": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/pacientes/importar/modelos": {
            "get": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1ModelosImportacao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "summary": "Import types and accepted columns",
                "description": "For each type (pacientes, consultas, alertas, episodios): whether the person can import it, the required and accepted columns and a sample line. Requires identification or clinical record edit (otherwise 403). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "tipo": {
                                                        "type": "string"
                                                    },
                                                    "rotulo": {
                                                        "type": "string"
                                                    },
                                                    "permitido": {
                                                        "type": "boolean"
                                                    },
                                                    "obrigatorias": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "colunas": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "exemplo": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "tipo": "alertas",
                                            "rotulo": "Alertas clínicos",
                                            "permitido": true,
                                            "obrigatorias": [
                                                "descricao",
                                                "paciente (uma das colunas de identificação)"
                                            ],
                                            "colunas": [
                                                "numero anterior",
                                                "tipo",
                                                "descricao",
                                                "gravidade"
                                            ],
                                            "exemplo": "numero anterior;tipo;descricao;gravidade\nA-1022;alergia;Penicilina;alta"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/pacientes/{id}/duplicados": {
            "get": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1DuplicadosPaciente",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "ver",
                "summary": "Possible duplicates of this patient",
                "description": "Compares the patient with the others in the clinic (excluding anonymised ones): same tax number 100, same email 85 (95 with the same date of birth), very similar name + same date 80, same phone 60 (80 with similar name), same date + same last surname 45. Only candidates scoring 40 or more, sorted, at most 12; «strong» from 80. Minimal identification only, with masked email and phone — never clinical data. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M1Duplicado"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 1388,
                                            "numero": "P-2026-0490",
                                            "nome_completo": "Rui M. Almeida",
                                            "data_nascimento": "1988-04-12",
                                            "email": "r•••@exemplo.pt",
                                            "telefone": "•••••5678",
                                            "estado": "ativo",
                                            "pontuacao": 95,
                                            "forte": true,
                                            "razoes": [
                                                "email",
                                                "nome_data"
                                            ],
                                            "razoes_rotulo": [
                                                "Mesmo email",
                                                "Nome parecido e mesma data de nascimento"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/pacientes/{id}/ficha": {
            "get": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1FichaPaciente",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "summary": "Open the patient record",
                "description": "Requires ficha.identificacao ≥ summary and the patient in scope (identification or clinical), or an active emergency access. Returns the header, the episodes (no clinical content), the active episode, the journey (stage 1–9 and the section to open at each stage), the visible sections with counters and the available actions. Contacts and date of birth only with ficha.identificacao ≥ view; clinical alerts only for callers who see the patient clinical record (otherwise alertas = [] and alertas_visiveis = false); the face photo only with ficha.fotografias. Opening is audited («ver», ficha). Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    },
                    {
                        "name": "episodio_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Episode to highlight (defaults to the active one, or the most recent)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1Ficha"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "paciente": {
                                            "id": 1204,
                                            "numero": "P-2026-0311",
                                            "nome": "Rui",
                                            "nome_completo": "Rui Almeida",
                                            "iniciais": "RA",
                                            "sexo": "M",
                                            "sexo_rotulo": "Masculino",
                                            "data_nascimento": "1988-04-12",
                                            "idade": 38,
                                            "email": "rui.almeida@exemplo.pt",
                                            "telefone": "+351912345678",
                                            "localidade": "Porto",
                                            "idioma": "pt-PT",
                                            "estado": "ativo",
                                            "estado_rotulo": "Ativo",
                                            "portal_ativo": true,
                                            "litigio": false,
                                            "medico": {
                                                "id": 7,
                                                "nome": "Inês Valente"
                                            },
                                            "responsavel": null,
                                            "foto_ficheiro_id": 8812,
                                            "criado_em": "2026-09-02T10:14:00+01:00"
                                        },
                                        "alertas": [
                                            {
                                                "id": 55,
                                                "tipo": "alergia",
                                                "tipo_rotulo": "Alergia",
                                                "gravidade": "alta",
                                                "gravidade_rotulo": "Alta",
                                                "descricao": "Alergia a penicilina (exantema)",
                                                "validado": true
                                            }
                                        ],
                                        "alertas_visiveis": true,
                                        "episodios": [
                                            {
                                                "id": 77,
                                                "numero": "E-2026-0077",
                                                "titulo": "Transplante capilar",
                                                "tecnica": "FUE",
                                                "area": "couro_cabeludo",
                                                "area_rotulo": "Couro cabeludo",
                                                "estado": "avaliacao",
                                                "estado_rotulo": "Avaliação",
                                                "etapa_jornada": 3,
                                                "medico_id": 7,
                                                "medico_nome": "Inês Valente",
                                                "aberto_em": "2026-10-02T09:30:00+01:00",
                                                "fechado_em": null,
                                                "equipa": [
                                                    {
                                                        "id": 301,
                                                        "utilizador_id": 7,
                                                        "papel": "medico",
                                                        "papel_rotulo": "Médico",
                                                        "nome": "Inês Valente"
                                                    }
                                                ]
                                            }
                                        ],
                                        "episodio_ativo": {
                                            "id": 77,
                                            "numero": "E-2026-0077",
                                            "titulo": "Transplante capilar",
                                            "tecnica": "FUE",
                                            "area": "couro_cabeludo",
                                            "area_rotulo": "Couro cabeludo",
                                            "estado": "avaliacao",
                                            "estado_rotulo": "Avaliação",
                                            "etapa_jornada": 3,
                                            "medico_id": 7,
                                            "medico_nome": "Inês Valente",
                                            "aberto_em": "2026-10-02T09:30:00+01:00",
                                            "fechado_em": null,
                                            "equipa": [
                                                {
                                                    "id": 301,
                                                    "utilizador_id": 7,
                                                    "papel": "medico",
                                                    "papel_rotulo": "Médico",
                                                    "nome": "Inês Valente"
                                                }
                                            ]
                                        },
                                        "jornada": {
                                            "etapa": 3,
                                            "episodio_id": 77,
                                            "seccoes": {
                                                "1": "linha_tempo",
                                                "2": "clinica",
                                                "3": "clinica",
                                                "4": "plano"
                                            }
                                        },
                                        "seccoes": [
                                            {
                                                "chave": "identificacao",
                                                "titulo": "Identificação",
                                                "icone": "ficha",
                                                "ordem": 10,
                                                "clinica": false,
                                                "contador": null,
                                                "modulo": "ficha.identificacao"
                                            },
                                            {
                                                "chave": "clinica",
                                                "titulo": "Clínica",
                                                "icone": "clinica",
                                                "ordem": 20,
                                                "clinica": true,
                                                "contador": 2,
                                                "modulo": "ficha.clinica"
                                            }
                                        ],
                                        "acoes": {
                                            "editar": true,
                                            "nova_consulta": true,
                                            "resumo_ia": true,
                                            "resumo_ia_configurado": true,
                                            "duplicados": true,
                                            "novo_episodio": true,
                                            "pedir_formulario": true,
                                            "emergencia": false,
                                            "prescrever_url": ""
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/pacientes/{id}/ficha/{seccao}": {
            "get": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1FichaSeccao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "summary": "Blocks of a record section",
                "description": "Sections discovered across every module: identificacao, clinica, alertas, episodios, linha_tempo (M1), consentimentos, documentos, privacidade (M2), fotografias, plano, acompanhamento (M3), comunicacoes (M4), financeiro (M5), marcacoes, cirurgias (M6). Each section requires its module permission and level (invisible section → 403); unknown or malformed key → 404. Blocks follow the single format (kpis, lista, campos, grafico, galeria, cronologia, alerta, jornada, acoes) and never carry fields without permission; at «summary» level only the authorised summary. Reading clinical sections (clinica, alertas, fotografias, plano, acompanhamento, cirurgias) is audited («ver», ficha.<section>). Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    },
                    {
                        "name": "seccao",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]{1,40}$"
                        },
                        "example": "clinica",
                        "description": "Section key"
                    },
                    {
                        "name": "episodio_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Episode to highlight (defaults to the active one, or the most recent)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1SeccaoFicha"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "chave": "clinica",
                                        "titulo": "Clínica",
                                        "icone": "clinica",
                                        "clinica": true,
                                        "blocos": [
                                            {
                                                "tipo": "campos",
                                                "itens": [
                                                    {
                                                        "rotulo": "Escala",
                                                        "valor": "Norwood IV"
                                                    },
                                                    {
                                                        "rotulo": "Elegibilidade",
                                                        "valor": "Apto com condições",
                                                        "tom": "aviso"
                                                    }
                                                ]
                                            },
                                            {
                                                "tipo": "lista",
                                                "itens": [
                                                    {
                                                        "titulo": "Primeira consulta",
                                                        "subtitulo": "Inês Valente",
                                                        "data": "2026-10-28T10:00:00+00:00",
                                                        "ligacao": {
                                                            "web": "equipa/consulta?id=4410",
                                                            "app": "/e/consulta?id=4410"
                                                        }
                                                    }
                                                ],
                                                "vazio": "Sem consultas."
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/pacientes/{id}/fundir": {
            "post": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1FundirPacientes",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "summary": "Assisted merge (keeps {id})",
                "description": "Requires confirmar = true. Copies into {id} the fields listed in «campos» (merge list only) and fills empty ones with those of remover_id; reassigns paciente_id in every system table (current clinic rows only), within a transaction; archives and soft-deletes remover_id. Immutable tables refusing the change are listed in «ignoradas». 422 if it is the same patient, does not exist or either is anonymised. Effects: timeline, «alterar» audit (kept) and «apagar» audit (removed), paciente.fundido webhook. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "remover_id": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "confirmar": {
                                        "const": true
                                    },
                                    "campos": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "enum": [
                                                "apelidos",
                                                "sexo",
                                                "data_nascimento",
                                                "nif",
                                                "documento_tipo",
                                                "documento_numero",
                                                "email",
                                                "telefone",
                                                "telefone_alt",
                                                "morada",
                                                "codigo_postal",
                                                "localidade",
                                                "pais",
                                                "nacionalidade",
                                                "idioma",
                                                "profissao",
                                                "medico_id",
                                                "responsavel_id",
                                                "origem",
                                                "cliente_desde"
                                            ]
                                        }
                                    }
                                },
                                "required": [
                                    "remover_id",
                                    "confirmar"
                                ]
                            },
                            "example": {
                                "remover_id": 1388,
                                "confirmar": true,
                                "campos": [
                                    "telefone",
                                    "morada"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1ResultadoFusao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "manter_id": 1204,
                                        "remover_id": 1388,
                                        "campos": [
                                            "telefone",
                                            "morada"
                                        ],
                                        "reafetados": {
                                            "consultas": 1,
                                            "marcacoes": 2,
                                            "formularios_respostas": 1
                                        },
                                        "ignoradas": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/pacientes/{id}/fundir/{outro_id}": {
            "get": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1CompararFusao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "summary": "Side-by-side comparison for merging",
                "description": "Identification only (full name and the fields the merge may copy); tax number and document masked. {id} is the patient that stays, {outro_id} the one to be merged in. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    },
                    {
                        "name": "outro_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient to merge in (will be removed)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1ComparacaoFusao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "manter": {
                                            "id": 1204,
                                            "numero": "P-2026-0311",
                                            "nome_completo": "Rui Almeida"
                                        },
                                        "remover": {
                                            "id": 1388,
                                            "numero": "P-2026-0490",
                                            "nome_completo": "Rui M. Almeida"
                                        },
                                        "campos": [
                                            {
                                                "campo": "telefone",
                                                "rotulo": "Telefone",
                                                "manter": "+351912345678",
                                                "remover": "+351934567890",
                                                "igual": false
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/pacientes/{id}/medicacao": {
            "get": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1AlertasMedicacao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "Medication alerts before prescribing",
                "description": "Checks a drug against the patient own record: 1) recorded allergies (active allergy alerts and allergies from the last consultation) mentioning the drug → «bloqueio»; 2) contraindication rules configured by the clinic (drug | terms to look for in the record | message | alert or block). seguro = false when there is any block. Prescribing itself happens in the certified software configured by the clinic. Requires clinical access to the patient. Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    },
                    {
                        "name": "farmaco",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                        },
                        "description": "Drug to check (fewer than 3 useful letters → no alerts)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1AlertasMedicacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "farmaco": "amoxicilina",
                                        "alertas": [
                                            {
                                                "nivel": "bloqueio",
                                                "mensagem": "Alergia registada: Alergia a penicilina (exantema)",
                                                "origem": "alergia"
                                            },
                                            {
                                                "nivel": "bloqueio",
                                                "mensagem": "Alergia registada a penicilinas ou betalactâmicos.",
                                                "origem": "regra"
                                            }
                                        ],
                                        "seguro": false
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/pacientes/{id}/resumo": {
            "get": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1UltimoResumo",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Latest record summary (doctors)",
                "description": "Latest summary generated for the patient (pending or accepted «resumo» proposal), to show without generating another; null when there is none. Doctors only («medico» profile family) with «edit» on ficha.clinica and the patient in clinical scope; other profiles receive 403. Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "oneOf": [
                                                {
                                                    "$ref": "#/components/schemas/M1PropostaIa"
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 9101,
                                        "paciente_id": 1204,
                                        "episodio_id": 77,
                                        "consulta_id": null,
                                        "resposta_id": null,
                                        "tipo": "resumo",
                                        "tipo_rotulo": "Resumo da ficha",
                                        "campo": "resumo",
                                        "campo_rotulo": "Resumo",
                                        "valor_proposto": "1) Homem de 38 anos, primeira consulta por queda frontal. 2) Alergia a penicilina; toma apixabano…",
                                        "excerto_origem": null,
                                        "fatores": {
                                            "fontes": {
                                                "alertas": 1,
                                                "consultas": 3,
                                                "episodios": 1
                                            }
                                        },
                                        "confianca": 0.92,
                                        "estado": "pendente",
                                        "estado_rotulo": "Pendente",
                                        "valor_final": null,
                                        "decidido_por": null,
                                        "decidido_em": null,
                                        "motivo": null,
                                        "lote": "3f2a9c0d6b1e4a7f8c2d5e9b0a1f3c4d",
                                        "criado_em": "2026-10-28T10:22:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1GerarResumo",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Generate the record summary before the consultation (doctors)",
                "description": "Gathers on the server the essentials of the record (age, sex, active alerts, last 3 consultations, episodes, complications and the latest pre-consultation questionnaire) and asks the clinic's AI assistant for a summary of up to 12 lines. No body. Uses the clinic's AI assistant: requires a valid «ia» consent from the patient and the use to be configured (otherwise 422). The result is never a decision — each value becomes a pending proposal (ia_propostas) recording the model used, the request parameters and the explanatory factors, until a doctor accepts, corrects or refuses it. Doctors only («medico» profile family) with «edit» on ficha.clinica and the patient in clinical scope; other profiles receive 403. Returns the created proposal (type «resumo», field «resumo»). Effects: pending proposal, «create» audit on ia_propostas. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After). Additional limit: 20 requests per 10 minutes per IP address (only data-changing requests count).",
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1PropostaIa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/pacientes/{id}/resumo-fhir": {
            "get": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1ResumoFhir",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "Patient summary in HL7 FHIR R4 (International Patient Summary)",
                "description": "Preparation for the European Health Data Space. FHIR R4 «document» Bundle with the IPS profile: Composition (LOINC 60591-5), Patient (record number, name, sex, date of birth — no tax number, ID document, contacts nor address), Organization (the clinic), allergy (48765-2), medication (10160-0) and problem (11450-4) sections from the active clinical alerts (validated → confirmed, awaiting validation → unconfirmed) and the diagnoses of signed consultations, and procedures (47519-4) from episodes at surgery or later; without data, the IPS «absent/unknown» entries. Sections the patient restricted in the portal are left out (emptyReason «withheld»), except with emergency access, which is recorded. By default returns the FHIR JSON as is (application/fhir+json); with envelope=1 it comes in the common envelope with meta.ficheiro. Team and integrations; the patient must be in clinical scope. Effects: «exportar» audit. Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per team token; integrations use the per-minute limit set on the integration client (429 with Retry-After). Additional limit: 30 requests per 10 minutes per IP address (only data-changing requests count).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Patient identifier"
                    },
                    {
                        "name": "envelope",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        },
                        "description": "1 → in the common envelope {ok, dados, meta}"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "FHIR R4 Bundle (IPS)",
                        "content": {
                            "application/fhir+json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "resourceType",
                                        "type",
                                        "entry"
                                    ],
                                    "properties": {
                                        "resourceType": {
                                            "const": "Bundle"
                                        },
                                        "type": {
                                            "const": "document"
                                        },
                                        "timestamp": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "format": "date-time"
                                        },
                                        "entry": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "resourceType": "Bundle",
                                    "type": "document",
                                    "timestamp": "2026-10-29T10:00:00+00:00",
                                    "entry": [
                                        {
                                            "fullUrl": "urn:uuid:…",
                                            "resource": {
                                                "resourceType": "Composition",
                                                "status": "final",
                                                "type": {
                                                    "coding": [
                                                        {
                                                            "system": "http://loinc.org",
                                                            "code": "60591-5"
                                                        }
                                                    ]
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/painel": {
            "get": {
                "tags": [
                    "Painel"
                ],
                "operationId": "obterPainel",
                "summary": "Dashboard of the current person",
                "description": "Discovers the cards of every module visible to the caller (permissions and clinic modules), orders them by role and saved preferences and returns each card's content as blocks (kpis, lista, campos, grafico, galeria, cronologia, alerta, jornada, acoes).\n\nHidden cards come with oculto=true and no blocks. A failing card returns an «alerta» block and erro=falhou — the others still load.",
                "x-anagen-modulo": null,
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "periodo",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "hoje",
                                "semana",
                                "mes",
                                "30d",
                                "trimestre",
                                "ano"
                            ]
                        },
                        "description": "Dashboard period.",
                        "example": "mes"
                    },
                    {
                        "name": "de",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Custom start."
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Custom end."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Painel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "periodo": {
                                            "chave": "mes",
                                            "de": "2026-10-01",
                                            "ate": "2026-10-28",
                                            "rotulo": "Este mês"
                                        },
                                        "saudacao": "Bom dia, Ana",
                                        "preferencias": {
                                            "ordem": [
                                                "resumo_executivo",
                                                "tarefas_de_hoje"
                                            ],
                                            "ocultos": [],
                                            "larguras": [],
                                            "periodo": "mes"
                                        },
                                        "blocos": [
                                            {
                                                "chave": "tarefas_de_hoje",
                                                "titulo": "As minhas tarefas",
                                                "icone": "tarefas",
                                                "largura": 2,
                                                "oculto": false,
                                                "blocos": [
                                                    {
                                                        "tipo": "kpis",
                                                        "itens": [
                                                            {
                                                                "rotulo": "Em atraso",
                                                                "valor": 2
                                                            }
                                                        ]
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/painel/blocos/{chave}": {
            "get": {
                "tags": [
                    "Painel"
                ],
                "operationId": "obterCartaoDoPainel",
                "summary": "One dashboard card",
                "description": "Fresh content of a single card (live refresh). 404 if the card does not exist or is not visible.",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "chave",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "tarefas_de_hoje"
                    },
                    {
                        "name": "periodo",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Period.",
                        "example": "mes"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CartaoPainel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/painel/preferencias": {
            "put": {
                "tags": [
                    "Painel"
                ],
                "operationId": "gravarPreferenciasDoPainel",
                "summary": "Save the dashboard layout",
                "description": "Order, hidden cards, widths (1–3) and default period. Only existing card keys are accepted. Stored per person (does not affect colleagues) and audited.",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PreferenciasPainel"
                            },
                            "example": {
                                "ordem": [
                                    "resumo_executivo",
                                    "tarefas_de_hoje",
                                    "chat_por_ler"
                                ],
                                "ocultos": [
                                    "comunicados_por_ler"
                                ],
                                "larguras": {
                                    "resumo_executivo": 3
                                },
                                "periodo": "semana"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PreferenciasPainel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/painel/repor": {
            "post": {
                "tags": [
                    "Painel"
                ],
                "operationId": "reporPainel",
                "summary": "Restore the default layout",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PreferenciasPainel"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/parceiros/auth/entrar": {
            "post": {
                "tags": [
                    "Parceiros"
                ],
                "operationId": "parceiroEntrar",
                "summary": "Sign in (get the token)",
                "description": "Same message for unknown email or wrong password. 403 conta_inativa when the account is unconfirmed, awaiting approval, suspended or declined. 404 when the partner portal is turned off.",
                "x-anagen-modulo": "parceiros",
                "x-anagen-nivel": "publico",
                "security": [],
                "parameters": [
                    {
                        "name": "X-AX-Clinica",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic code (in the app; on the web the domain applies)."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "email",
                                    "palavra_passe"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "palavra_passe": {
                                        "type": "string"
                                    },
                                    "dispositivo": {
                                        "type": "string",
                                        "maxLength": 190
                                    }
                                }
                            },
                            "example": {
                                "email": "dra.silva@clinica-parceira.pt",
                                "palavra_passe": "••••••••••••",
                                "dispositivo": "iPhone"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "token": {
                                                    "type": "string"
                                                },
                                                "expira_em": {
                                                    "type": "string",
                                                    "format": "date-time"
                                                },
                                                "parceiro": {
                                                    "$ref": "#/components/schemas/PerfilParceiro"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "token": "axp_9f0c…",
                                        "expira_em": "2026-11-28T10:00:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/parceiros/auth/recuperar": {
            "post": {
                "tags": [
                    "Parceiros"
                ],
                "operationId": "parceiroRecuperar",
                "summary": "Request a new password",
                "x-anagen-modulo": "parceiros",
                "x-anagen-nivel": "publico",
                "security": [],
                "parameters": [
                    {
                        "name": "X-AX-Clinica",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic code (in the app; on the web the domain applies)."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "email"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    }
                                }
                            },
                            "example": {
                                "email": "dra.silva@clinica-parceira.pt"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/parceiros/auth/registar": {
            "post": {
                "tags": [
                    "Parceiros"
                ],
                "operationId": "parceiroRegistar",
                "summary": "Request access",
                "description": "Creates the account «to confirm» and sends the verification link (48 h). Same answer whether or not the email exists. Trap field «website» must be empty.",
                "x-anagen-modulo": "parceiros",
                "x-anagen-nivel": "publico",
                "security": [],
                "parameters": [
                    {
                        "name": "X-AX-Clinica",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Clinic code (in the app; on the web the domain applies)."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "tipo",
                                    "nome",
                                    "email",
                                    "palavra_passe",
                                    "termos"
                                ],
                                "properties": {
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "medico",
                                            "clinica",
                                            "outro"
                                        ]
                                    },
                                    "nome": {
                                        "type": "string",
                                        "maxLength": 160
                                    },
                                    "organizacao": {
                                        "type": "string",
                                        "maxLength": 190
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "telefone": {
                                        "type": "string"
                                    },
                                    "cedula": {
                                        "type": "string",
                                        "maxLength": 30
                                    },
                                    "palavra_passe": {
                                        "type": "string",
                                        "minLength": 12
                                    },
                                    "termos": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "tipo": "medico",
                                "nome": "Marta Silva",
                                "organizacao": "Clínica Dermatológica Exemplo",
                                "email": "dra.silva@clinica-parceira.pt",
                                "palavra_passe": "••••••••••••",
                                "termos": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/parceiros/auth/sair": {
            "post": {
                "tags": [
                    "Parceiros"
                ],
                "operationId": "parceiroSair",
                "summary": "Sign out (revokes the token)",
                "x-anagen-modulo": "parceiros",
                "x-anagen-nivel": "parceiro",
                "security": [],
                "parameters": [
                    {
                        "name": "X-AX-Parceiro",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^axp_[a-f0-9]{40}$"
                        },
                        "description": "Partner token (also accepted as Authorization: Bearer axp_…)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/parceiros/conta": {
            "get": {
                "tags": [
                    "Parceiros"
                ],
                "operationId": "parceiroConta",
                "summary": "My account",
                "x-anagen-modulo": "parceiros",
                "x-anagen-nivel": "parceiro",
                "security": [],
                "parameters": [
                    {
                        "name": "X-AX-Parceiro",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^axp_[a-f0-9]{40}$"
                        },
                        "description": "Partner token (also accepted as Authorization: Bearer axp_…)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PerfilParceiro"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/parceiros/conta/palavra-passe": {
            "post": {
                "tags": [
                    "Parceiros"
                ],
                "operationId": "parceiroPalavraPasse",
                "summary": "Change the password",
                "description": "Ends every session and token (sessao_terminada=true): sign in again.",
                "x-anagen-modulo": "parceiros",
                "x-anagen-nivel": "parceiro",
                "security": [],
                "parameters": [
                    {
                        "name": "X-AX-Parceiro",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^axp_[a-f0-9]{40}$"
                        },
                        "description": "Partner token (also accepted as Authorization: Bearer axp_…)."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "atual",
                                    "nova"
                                ],
                                "properties": {
                                    "atual": {
                                        "type": "string"
                                    },
                                    "nova": {
                                        "type": "string",
                                        "minLength": 12
                                    }
                                }
                            },
                            "example": {
                                "atual": "••••••••••••",
                                "nova": "••••••••••••••"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "sessao_terminada": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/parceiros/encaminhamentos": {
            "post": {
                "tags": [
                    "Parceiros"
                ],
                "operationId": "parceiroEncaminhar",
                "summary": "Refer a patient",
                "description": "The partner declares the patient agreed to be contacted. Creates the lead in the clinic CRM (origin «recommendation») and notifies the team. At least email or phone. Avoid health data in the note.",
                "x-anagen-modulo": "parceiros",
                "x-anagen-nivel": "parceiro",
                "security": [],
                "parameters": [
                    {
                        "name": "X-AX-Parceiro",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^axp_[a-f0-9]{40}$"
                        },
                        "description": "Partner token (also accepted as Authorization: Bearer axp_…)."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "nome",
                                    "declaracao"
                                ],
                                "properties": {
                                    "nome": {
                                        "type": "string",
                                        "maxLength": 160
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "telefone": {
                                        "type": "string"
                                    },
                                    "nota": {
                                        "type": "string",
                                        "maxLength": 1000
                                    },
                                    "procedimento_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "declaracao": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "nome": "João Pereira",
                                "telefone": "+351912345678",
                                "declaracao": true
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EncaminhamentoParceiro"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 14,
                                        "codigo": "EN-3FA21C",
                                        "nome": "João Pereira",
                                        "contacto": {
                                            "telefone": "+351912345678"
                                        },
                                        "criado_em": "2026-10-21T10:02:00+00:00",
                                        "estado": "avaliacao",
                                        "estado_rotulo": "Em avaliação",
                                        "autorizado": false,
                                        "recompensa": {
                                            "aplicavel": false,
                                            "estado": null,
                                            "rotulo": "Não aplicável"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/parceiros/encaminhamentos/{id}": {
            "get": {
                "tags": [
                    "Parceiros"
                ],
                "operationId": "parceiroEncaminhamento",
                "summary": "One referral (status and, with authorisation, progress)",
                "x-anagen-modulo": "parceiros",
                "x-anagen-nivel": "parceiro",
                "security": [],
                "parameters": [
                    {
                        "name": "X-AX-Parceiro",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^axp_[a-f0-9]{40}$"
                        },
                        "description": "Partner token (also accepted as Authorization: Bearer axp_…)."
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 14
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/EncaminhamentoParceiro"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "nota": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "passos": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object"
                                                            }
                                                        },
                                                        "autorizacao": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ]
                                                        },
                                                        "evolucao": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "consulta_em": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ],
                                                                    "format": "date"
                                                                },
                                                                "cirurgia_em": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ],
                                                                    "format": "date"
                                                                },
                                                                "procedimento": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "marcos_feitos": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "marcos_total": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/parceiros/painel": {
            "get": {
                "tags": [
                    "Parceiros"
                ],
                "operationId": "parceiroPainel",
                "summary": "My referrals",
                "x-anagen-modulo": "parceiros",
                "x-anagen-nivel": "parceiro",
                "security": [],
                "parameters": [
                    {
                        "name": "X-AX-Parceiro",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^axp_[a-f0-9]{40}$"
                        },
                        "description": "Partner token (also accepted as Authorization: Bearer axp_…)."
                    },
                    {
                        "name": "estado",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "recebido",
                                "em_contacto",
                                "avaliacao",
                                "concluido",
                                "sem_seguimento"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "parceiro": {
                                                    "$ref": "#/components/schemas/PerfilParceiro"
                                                },
                                                "kpis": {
                                                    "type": "object"
                                                },
                                                "estados": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "filtro": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "encaminhamentos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/EncaminhamentoParceiro"
                                                    }
                                                },
                                                "recompensas": {
                                                    "type": "boolean"
                                                },
                                                "procedimentos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "nome": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/perfil": {
            "get": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "obterPerfil",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "My profile",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "nome": {
                                                    "type": "string"
                                                },
                                                "email": {
                                                    "type": "string"
                                                },
                                                "telefone": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "tema": {
                                                    "type": "string",
                                                    "enum": [
                                                        "sistema",
                                                        "claro",
                                                        "escuro"
                                                    ]
                                                },
                                                "idioma": {
                                                    "type": "string"
                                                },
                                                "foto_url": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "perfil": {
                                                    "type": "object"
                                                },
                                                "segundo_fator": {
                                                    "type": "boolean"
                                                },
                                                "codigos_restantes": {
                                                    "type": "integer"
                                                },
                                                "sigilo_versao": {
                                                    "type": "integer"
                                                },
                                                "sigilo_aceite_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "ultimo_acesso_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            },
            "put": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "gravarPerfil",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Change personal data and preferences (only the fields sent)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string"
                                    },
                                    "telefone": {
                                        "type": "string"
                                    },
                                    "tema": {
                                        "type": "string",
                                        "enum": [
                                            "sistema",
                                            "claro",
                                            "escuro"
                                        ]
                                    },
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/perfil/2fa": {
            "get": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "estadoSegundoFator",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Second factor status",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ativo": {
                                                    "type": "boolean"
                                                },
                                                "obrigatorio": {
                                                    "type": "boolean"
                                                },
                                                "codigos_restantes": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/perfil/2fa/ativar": {
            "post": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "ativarSegundoFator",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Confirm and enable the second factor",
                "description": "«atual» (password) is only required when the second factor was already active (reconfiguration). Returns the recovery codes.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "codigo": {
                                        "type": "string"
                                    },
                                    "atual": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "codigo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "codigos_recuperacao": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/perfil/2fa/codigos": {
            "post": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "novosCodigosRecuperacao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Generate new recovery codes",
                "description": "Confirm with the password («atual») or a code («codigo»). Previous ones stop working. Also at POST /perfil/codigos.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "atual": {
                                        "type": "string"
                                    },
                                    "codigo": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "codigos_recuperacao": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/perfil/2fa/desativar": {
            "post": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "desativarSegundoFator",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Disable the second factor",
                "description": "Refused when the clinic makes it mandatory. Requires a valid code.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "codigo": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "codigo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ativo": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/perfil/2fa/iniciar": {
            "post": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "iniciarSegundoFator",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Start second-factor setup",
                "description": "Returns the secret and the otpauth:// address (QR code). Pending confirmation for 10 minutes.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "segredo": {
                                                    "type": "string"
                                                },
                                                "otpauth": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/perfil/codigos": {
            "post": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "novosCodigosRecuperacaoAlias",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Generate new recovery codes (alias)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "atual": {
                                        "type": "string"
                                    },
                                    "codigo": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "codigos_recuperacao": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/perfil/palavra-passe": {
            "post": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "mudarPalavraPasse",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Change password",
                "description": "Ends the other sessions of the account.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "atual": {
                                        "type": "string"
                                    },
                                    "nova": {
                                        "type": "string",
                                        "minLength": 12
                                    }
                                },
                                "required": [
                                    "atual",
                                    "nova"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/perfil/sessoes": {
            "get": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "sessoes",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Open app sessions",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "dispositivo": {
                                                        "type": "string"
                                                    },
                                                    "plataforma": {
                                                        "type": "string"
                                                    },
                                                    "ip": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "ultimo_uso_em": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "criado_em": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "atual": {
                                                        "type": "boolean"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "terminarOutrasSessoes",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "End all other sessions",
                "description": "Also at POST /perfil/sessoes/revogar.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/perfil/sessoes/revogar": {
            "post": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "terminarOutrasSessoesPost",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "End all other sessions",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/perfil/sessoes/{id}": {
            "delete": {
                "tags": [
                    "Perfil"
                ],
                "operationId": "terminarSessao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "End one session",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/permissoes": {
            "get": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "matrizPermissoes",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Permission matrix",
                "description": "profiles, modules (with group, clinical, always active), cells/matrix (profile_id → module → {nivel, ambito, aprovar, exportar}), ceilings (data-protection limits per profile family), scopes, phases (phase rules per profile), positions (additions per position), resources (with configurable fields) and editavel. Requires Users › View.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "perfis": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "modulos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "celulas": {
                                                    "type": "object"
                                                },
                                                "matriz": {
                                                    "type": "object"
                                                },
                                                "tetos": {
                                                    "type": "object"
                                                },
                                                "ambitos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "fases": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "cargos": {
                                                    "type": "object"
                                                },
                                                "recursos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "editavel": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "put": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "gravarCelulas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Save matrix cells",
                "description": "Values above the data-protection ceiling are refused. Nobody can remove access management from themselves.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "celulas": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "perfil_id",
                                                "modulo",
                                                "nivel"
                                            ],
                                            "properties": {
                                                "perfil_id": {
                                                    "type": "integer"
                                                },
                                                "modulo": {
                                                    "type": "string"
                                                },
                                                "nivel": {
                                                    "type": "string",
                                                    "enum": [
                                                        "nenhum",
                                                        "resumo",
                                                        "ver",
                                                        "editar"
                                                    ]
                                                },
                                                "ambito": {
                                                    "type": "string",
                                                    "enum": [
                                                        "proprios",
                                                        "equipa",
                                                        "departamento",
                                                        "todos"
                                                    ]
                                                },
                                                "aprovar": {
                                                    "type": "boolean"
                                                },
                                                "exportar": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "celulas"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "gravadas": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/permissoes/campos": {
            "get": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "permissoesCamposRecursos",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Resources with fields configurable per profile",
                "parameters": [
                    {
                        "name": "perfil_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "chave": {
                                                        "type": "string"
                                                    },
                                                    "titulo": {
                                                        "type": "string"
                                                    },
                                                    "modulo": {
                                                        "type": "string"
                                                    },
                                                    "grupo": {
                                                        "type": "string"
                                                    },
                                                    "campos": {
                                                        "type": "integer"
                                                    },
                                                    "regras": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/permissoes/campos/{perfil_id}/{recurso}": {
            "get": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "permissoesCampos",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Fields of a resource with the profile rule",
                "description": "regra: '' (as defined), oculto (never leaves the server) or so_leitura (writes are refused). Required fields and users/profiles fields of your own profile do not accept rules (bloqueado + motivo).",
                "parameters": [
                    {
                        "name": "perfil_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "recurso",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "perfil": {
                                                    "type": "object"
                                                },
                                                "recurso": {
                                                    "type": "object"
                                                },
                                                "campos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "editavel": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            },
            "put": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "gravarPermissoesCampos",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Save hidden or read-only fields",
                "parameters": [
                    {
                        "name": "perfil_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "recurso",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "campos": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "string",
                                            "enum": [
                                                "",
                                                "oculto",
                                                "so_leitura"
                                            ]
                                        }
                                    }
                                },
                                "required": [
                                    "campos"
                                ]
                            },
                            "example": {
                                "campos": {
                                    "valor_estimado": "oculto",
                                    "origem": "so_leitura",
                                    "notas": ""
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "gravadas": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/permissoes/cargos": {
            "get": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "permissoesCargos",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Permissions per position",
                "description": "Additions for chefe_equipa and direcao, per department ('' = all): celulas[cargo][departamento][modulo] = {nivel, ambito, aprovar, exportar}; ambito_por_cargo (team lead → team, management → department in non-clinical modules) and whether it is on. Data-protection ceilings always apply.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "cargos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "departamentos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "celulas": {
                                                    "type": "object"
                                                },
                                                "ambito_por_cargo": {
                                                    "type": "object"
                                                },
                                                "ambito_por_cargo_ativo": {
                                                    "type": "boolean"
                                                },
                                                "modulos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "ambitos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "editavel": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "put": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "gravarCargos",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Save position additions (level «nenhum» removes)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "celulas": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "cargo",
                                                "modulo",
                                                "nivel"
                                            ],
                                            "properties": {
                                                "cargo": {
                                                    "type": "string",
                                                    "enum": [
                                                        "chefe_equipa",
                                                        "direcao"
                                                    ]
                                                },
                                                "departamento": {
                                                    "type": "string"
                                                },
                                                "modulo": {
                                                    "type": "string"
                                                },
                                                "nivel": {
                                                    "type": "string",
                                                    "enum": [
                                                        "nenhum",
                                                        "resumo",
                                                        "ver",
                                                        "editar"
                                                    ]
                                                },
                                                "ambito": {
                                                    "type": "string",
                                                    "enum": [
                                                        "proprios",
                                                        "equipa",
                                                        "departamento",
                                                        "todos"
                                                    ]
                                                },
                                                "aprovar": {
                                                    "type": "boolean"
                                                },
                                                "exportar": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "celulas"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "gravadas": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/permissoes/excecoes/{id}/revogar": {
            "post": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "revogarExcecao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Revoke an exception before its end",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 5,
                                        "maxLength": 255
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "utilizador_id": {
                                                    "type": "integer"
                                                },
                                                "excecoes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/permissoes/fases": {
            "get": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "permissoesFases",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Phase rules per profile",
                "description": "Phase dimension of the matrix: rules declared per module (type estado|preenchido|dia|passado|jornada) and, per profile, {ativa, nivel (maximum within the phase: nenhum|resumo|ver), origem perfil|omissao}. E.g. sales edit a proposal only until it is accepted; nursing records only on the surgery day. Requires Users › View.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "perfis": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "regras": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "niveis": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "editavel": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "put": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "gravarFases",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Turn phase rules on/off per profile",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "regras": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "perfil_id",
                                                "modulo",
                                                "regra"
                                            ],
                                            "properties": {
                                                "perfil_id": {
                                                    "type": "integer"
                                                },
                                                "modulo": {
                                                    "type": "string"
                                                },
                                                "regra": {
                                                    "type": "string"
                                                },
                                                "ativa": {
                                                    "type": "boolean"
                                                },
                                                "nivel": {
                                                    "type": "string",
                                                    "enum": [
                                                        "nenhum",
                                                        "resumo",
                                                        "ver"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "regras"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "gravadas": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/permissoes/perfis": {
            "post": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "clonarPerfil",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Create a profile from another",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "base_id": {
                                        "type": "integer"
                                    },
                                    "nome": {
                                        "type": "string"
                                    },
                                    "descricao": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "base_id",
                                    "nome"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/permissoes/perfis/{id}": {
            "put": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "renomearPerfil",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Rename profile",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string"
                                    },
                                    "descricao": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "nome"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "apagarPerfil",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Delete profile (no people and not a base profile)",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    }
                }
            }
        },
        "/permissoes/pessoas": {
            "get": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "permissoesPessoas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "People and their profiles",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/permissoes/pessoas/{id}": {
            "get": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "permissoesPessoa",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Effective permissions of one person",
                "description": "permissoes (module → {nivel, ambito, aprovar, exportar, origem perfil|cargo|delegacao|excecao|retirada|global|inativo, cargo_ambito}), position, department, teams, delegations, exceptions and editavel. Also at GET /permissoes/utilizadores/{id}.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/permissoes/pessoas/{id}/excecoes": {
            "get": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "excecoesPessoa",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Permission exceptions of one person",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "modulo": {
                                                        "type": "string"
                                                    },
                                                    "tipo": {
                                                        "type": "string",
                                                        "enum": [
                                                            "conceder",
                                                            "retirar"
                                                        ]
                                                    },
                                                    "nivel": {
                                                        "type": "string"
                                                    },
                                                    "ambito": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "aprovar": {
                                                        "type": "boolean"
                                                    },
                                                    "exportar": {
                                                        "type": "boolean"
                                                    },
                                                    "inicio": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "fim": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "motivo": {
                                                        "type": "string"
                                                    },
                                                    "estado": {
                                                        "type": "string",
                                                        "enum": [
                                                            "ativa",
                                                            "agendada",
                                                            "expirada",
                                                            "revogada"
                                                        ]
                                                    },
                                                    "autor": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "post": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "criarExcecao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Grant or remove a module/level for one person",
                "description": "conceder: grants the level (never above the profile family ceiling); retirar: the level becomes at most the one given (nenhum = no module) and aprovar/exportar = 1 remove those flags. Optional end; reason required. Nobody creates exceptions for themselves; removing ends the person's sessions. Audited.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "modulo": {
                                        "type": "string"
                                    },
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "conceder",
                                            "retirar"
                                        ]
                                    },
                                    "nivel": {
                                        "type": "string",
                                        "enum": [
                                            "nenhum",
                                            "resumo",
                                            "ver",
                                            "editar"
                                        ]
                                    },
                                    "ambito": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "proprios",
                                            "equipa",
                                            "departamento",
                                            "todos",
                                            null
                                        ]
                                    },
                                    "aprovar": {
                                        "type": "boolean"
                                    },
                                    "exportar": {
                                        "type": "boolean"
                                    },
                                    "fim": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time"
                                    },
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 5,
                                        "maxLength": 255
                                    }
                                },
                                "required": [
                                    "modulo",
                                    "tipo",
                                    "nivel",
                                    "motivo"
                                ]
                            },
                            "example": {
                                "modulo": "indicadores.financeiros",
                                "tipo": "conceder",
                                "nivel": "ver",
                                "fim": "2026-11-30T23:59:00+00:00",
                                "motivo": "Substituição da diretora financeira durante as férias"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "excecoes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/permissoes/utilizadores/{id}": {
            "get": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "permissoesUtilizador",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Effective permissions of one person (alias)",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/permissoes/{perfil_id}": {
            "put": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "gravarPerfilPermissoes",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Save the rows of one profile",
                "description": "Accepts {linhas:[…]} or {modulos:{<module>:{nivel, ambito, aprovar, exportar}}} (app format).",
                "parameters": [
                    {
                        "name": "perfil_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "linhas": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "modulo": {
                                                    "type": "string"
                                                },
                                                "nivel": {
                                                    "type": "string"
                                                },
                                                "ambito": {
                                                    "type": "string"
                                                },
                                                "aprovar": {
                                                    "type": "boolean"
                                                },
                                                "exportar": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    },
                                    "modulos": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "gravadas": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/permissoes/{perfil_id}/clonar": {
            "post": {
                "tags": [
                    "Permissões"
                ],
                "operationId": "clonarPerfilDe",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "perfil_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Clone a profile",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string"
                                    },
                                    "descricao": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "nome"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos": {
            "get": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "listarPlanos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "resumo",
                "summary": "List plans",
                "description": "Plans within the user's scope. Users with only the «summary» level receive the authorised summary (no clinical data). Without a status filter, substituted versions are left out.",
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient"
                    },
                    {
                        "name": "episodio_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Episode"
                    },
                    {
                        "name": "estado",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "rascunho",
                                "em_revisao",
                                "aprovado",
                                "substituido"
                            ]
                        },
                        "description": "Status"
                    },
                    {
                        "name": "pagina",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Page"
                    },
                    {
                        "name": "por_pagina",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 100
                        },
                        "description": "Rows per page"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/PlanoLinha"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 318,
                                            "paciente_id": 1204,
                                            "versao": 3,
                                            "estado": "em_revisao",
                                            "enxertos_necessarios": {
                                                "valor": 3200,
                                                "unidade": "enxertos"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "criarPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Create plan",
                "description": "Creates a draft plan with the diagram zones (densities suggested by the engine version) and the donor (trichoscopy averages, or the reference safe area). Scale, grade and PRECISE come from the last consultation when available. Effects: timeline, audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "episodio_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "tecnica": {
                                        "type": "string",
                                        "enum": [
                                            "FUE",
                                            "FUT",
                                            "DHI",
                                            "outra"
                                        ]
                                    }
                                },
                                "required": [
                                    "paciente_id"
                                ]
                            },
                            "example": {
                                "paciente_id": 1204,
                                "episodio_id": 77,
                                "tecnica": "FUE"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PlanoEditor"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/planos/conta-dadora/{paciente_id}": {
            "get": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "contaDadora",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "ver",
                "summary": "Donor reserve ledger",
                "description": "Lifetime capacity (latest approved plan) − grafts extracted in each closed surgery − reserve for future loss = available; lifetime ceiling.",
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ContaDadora"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/planos/proporcoes/{id}/decidir": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "decidirProporcoes",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Accept, correct or reject the thirds",
                "description": "Accepted or corrected → «Facial thirds» drawing layer on the photo.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "aceite",
                                            "corrigida",
                                            "recusada"
                                        ]
                                    },
                                    "valores": {
                                        "type": "object",
                                        "properties": {
                                            "trichion": {
                                                "type": "number"
                                            },
                                            "glabela": {
                                                "type": "number"
                                            },
                                            "subnasal": {
                                                "type": "number"
                                            },
                                            "mento": {
                                                "type": "number"
                                            },
                                            "linha_media": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "motivo": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "analise": {
                                                    "$ref": "#/components/schemas/AnaliseProporcoes"
                                                },
                                                "camada_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}": {
            "get": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "obterPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "resumo",
                "summary": "Get the plan (editor or summary)",
                "description": "With «view»/«edit»: plan, zones, donors, density references per zone, last result, engine version, versions, donor ledger, simulation, captures and 3D models, trichoscopy averages and permissions. With «summary»: {modo:\"resumo\", resumo}. Read is audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PlanoEditor"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "put": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "gravarPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Save the draft (and recalculate)",
                "description": "Draft only. Saves plan data, zones and donors and the recalculated result. Areas from «modelo3d» come from the server-side model; «diagrama» uses the standard head areas. Wrong unit → 422.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/EntradaCalculo"
                            },
                            "example": {
                                "plano": {
                                    "cenario": "provavel",
                                    "margem_pct": 0,
                                    "escala": "norwood",
                                    "grau": "V"
                                },
                                "zonas": [
                                    {
                                        "zona": "linha_frontal",
                                        "area_cm2": {
                                            "valor": 15,
                                            "unidade": "cm²"
                                        },
                                        "densidade_alvo": {
                                            "valor": 25,
                                            "unidade": "UF/cm²"
                                        },
                                        "origem_area": "manual",
                                        "incluida": true,
                                        "fase": 1
                                    },
                                    {
                                        "zona": "coroa",
                                        "area_cm2": 70,
                                        "densidade_alvo": 20,
                                        "origem_area": "modelo3d"
                                    }
                                ],
                                "dadoras": [
                                    {
                                        "subzona": "occipital",
                                        "area_cm2": 190,
                                        "densidade_uf_cm2": 75,
                                        "cabelos_por_uf": 2.1,
                                        "calibre_mm": 0.065,
                                        "extraidos_anteriores": 0
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "resultado": {
                                                    "$ref": "#/components/schemas/ResultadoMotor"
                                                },
                                                "gravado": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "resultado": {
                                            "bloqueado": false,
                                            "motivos": [],
                                            "cenario": "provavel",
                                            "numeros": {
                                                "necessidade": {
                                                    "valor": 5625,
                                                    "unidade": "enxertos",
                                                    "min": 5344,
                                                    "max": 5907,
                                                    "formula": "N = Σ G × (1 + margem)",
                                                    "passos": [
                                                        "Linha frontal: 15 cm² × 25 UF/cm² = 375 enxertos",
                                                        "…",
                                                        "Soma das zonas: 5 625 enxertos"
                                                    ],
                                                    "parametros": [
                                                        {
                                                            "chave": "margem",
                                                            "nome": "Margem",
                                                            "valor": 0,
                                                            "unidade": "%",
                                                            "referencia": null,
                                                            "fonte": "sem fonte primária"
                                                        }
                                                    ],
                                                    "fonte": "Análise de referências e funcionalidades, secção 5 (27/10/2026)"
                                                },
                                                "residual_minima": {
                                                    "valor": 50,
                                                    "unidade": "UF/cm²",
                                                    "criterio": "cabelos"
                                                },
                                                "capacidade_vida": {
                                                    "valor": 4750,
                                                    "unidade": "enxertos",
                                                    "min": 4512,
                                                    "max": 4987
                                                },
                                                "capacidade_sessao": {
                                                    "valor": 2850,
                                                    "unidade": "enxertos"
                                                },
                                                "sessoes": {
                                                    "valor": 2,
                                                    "unidade": "sessões"
                                                },
                                                "balanco": {
                                                    "valor": -875,
                                                    "unidade": "enxertos",
                                                    "min": -1395,
                                                    "max": -357
                                                }
                                            },
                                            "plano_sessoes": [
                                                {
                                                    "sessao": 1,
                                                    "enxertos": {
                                                        "valor": 2850,
                                                        "unidade": "enxertos"
                                                    },
                                                    "densidade_antes": {
                                                        "valor": 75,
                                                        "unidade": "UF/cm²"
                                                    },
                                                    "densidade_depois": {
                                                        "valor": 60,
                                                        "unidade": "UF/cm²"
                                                    }
                                                },
                                                {
                                                    "sessao": 2,
                                                    "enxertos": {
                                                        "valor": 1900,
                                                        "unidade": "enxertos"
                                                    },
                                                    "densidade_antes": {
                                                        "valor": 60,
                                                        "unidade": "UF/cm²"
                                                    },
                                                    "densidade_depois": {
                                                        "valor": 50,
                                                        "unidade": "UF/cm²"
                                                    }
                                                }
                                            ],
                                            "propostas": [
                                                {
                                                    "codigo": "baixar_coroa",
                                                    "ordem": 1,
                                                    "efeito": {
                                                        "valor": 350,
                                                        "unidade": "enxertos"
                                                    },
                                                    "balanco_depois": {
                                                        "valor": -525,
                                                        "unidade": "enxertos"
                                                    },
                                                    "disponivel": true
                                                }
                                            ],
                                            "avisos": [
                                                {
                                                    "codigo": "limite_dador",
                                                    "nivel": "aviso",
                                                    "texto": "Défice de 875 enxertos face à capacidade dadora.",
                                                    "campo": null
                                                }
                                            ]
                                        },
                                        "gravado": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/planos/{id}/analise": {
            "get": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "analisePlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "ver",
                "summary": "Future loss, expectations, facial proportions and actual surgery",
                "description": "perda_futura: expected grade, future grafts from the zone × grade table and whether the donor reserve suffices. expectativas: natural vs expected density per zone, normal-appearance threshold and the approved text. real: hairs per graft measured in the last surgery.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/AnalisePlano"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/planos/{id}/aprovar": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "aprovarPlano",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "aprovar",
                "summary": "Approve the plan (doctor)",
                "description": "Requires «approve» on ficha.plano and an approved engine version. Recalculates with that version, refuses if blocked, stores the SHA-256 fingerprint of the canonical JSON (input + parameters + version + result) and turns the previous approved one into «substituido». If a surgical consent was already signed, returns the «renovar_consentimento» warning and creates a nursing task. Effects: timeline, «approve» audit, plano.aprovado webhook, episode journey → proposal.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "plano": {
                                                    "$ref": "#/components/schemas/PlanoEditor"
                                                },
                                                "avisos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Aviso"
                                                    }
                                                },
                                                "impressao_digital": {
                                                    "type": "string"
                                                },
                                                "substituidos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "impressao_digital": "b1946ac92492d2347c6235b4d2611184e7a4b8f3c2d1e0f9a8b7c6d5e4f3a2b1",
                                        "avisos": [],
                                        "substituidos": [
                                            311
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}/calcular": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "calcularPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "ver",
                "summary": "Calculate on the server (single source of numbers)",
                "description": "Runs the calculation engine with the posted (unsaved) values over the saved plan: need, minimum residual, lifetime and per-session capacity, session-by-session plan, balance, PRECISE and Norwood checks, proposals for negative balance, warnings and blocks, and the three scenarios. Every number carries unit, interval, formula, step-by-step, parameters and source. With gravar:true it saves (requires edit). Value P is only returned to users who see clinic-wide values.",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/EntradaCalculo"
                            },
                            "example": {
                                "plano": {
                                    "cenario": "provavel",
                                    "margem_pct": 0,
                                    "escala": "norwood",
                                    "grau": "V"
                                },
                                "zonas": [
                                    {
                                        "zona": "linha_frontal",
                                        "area_cm2": {
                                            "valor": 15,
                                            "unidade": "cm²"
                                        },
                                        "densidade_alvo": {
                                            "valor": 25,
                                            "unidade": "UF/cm²"
                                        },
                                        "origem_area": "manual",
                                        "incluida": true,
                                        "fase": 1
                                    },
                                    {
                                        "zona": "coroa",
                                        "area_cm2": 70,
                                        "densidade_alvo": 20,
                                        "origem_area": "modelo3d"
                                    }
                                ],
                                "dadoras": [
                                    {
                                        "subzona": "occipital",
                                        "area_cm2": 190,
                                        "densidade_uf_cm2": 75,
                                        "cabelos_por_uf": 2.1,
                                        "calibre_mm": 0.065,
                                        "extraidos_anteriores": 0
                                    }
                                ],
                                "gravar": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "resultado": {
                                                    "$ref": "#/components/schemas/ResultadoMotor"
                                                },
                                                "gravado": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "resultado": {
                                            "bloqueado": false,
                                            "motivos": [],
                                            "cenario": "provavel",
                                            "numeros": {
                                                "necessidade": {
                                                    "valor": 5625,
                                                    "unidade": "enxertos",
                                                    "min": 5344,
                                                    "max": 5907,
                                                    "formula": "N = Σ G × (1 + margem)",
                                                    "passos": [
                                                        "Linha frontal: 15 cm² × 25 UF/cm² = 375 enxertos",
                                                        "…",
                                                        "Soma das zonas: 5 625 enxertos"
                                                    ],
                                                    "parametros": [
                                                        {
                                                            "chave": "margem",
                                                            "nome": "Margem",
                                                            "valor": 0,
                                                            "unidade": "%",
                                                            "referencia": null,
                                                            "fonte": "sem fonte primária"
                                                        }
                                                    ],
                                                    "fonte": "Análise de referências e funcionalidades, secção 5 (27/10/2026)"
                                                },
                                                "residual_minima": {
                                                    "valor": 50,
                                                    "unidade": "UF/cm²",
                                                    "criterio": "cabelos"
                                                },
                                                "capacidade_vida": {
                                                    "valor": 4750,
                                                    "unidade": "enxertos",
                                                    "min": 4512,
                                                    "max": 4987
                                                },
                                                "capacidade_sessao": {
                                                    "valor": 2850,
                                                    "unidade": "enxertos"
                                                },
                                                "sessoes": {
                                                    "valor": 2,
                                                    "unidade": "sessões"
                                                },
                                                "balanco": {
                                                    "valor": -875,
                                                    "unidade": "enxertos",
                                                    "min": -1395,
                                                    "max": -357
                                                }
                                            },
                                            "plano_sessoes": [
                                                {
                                                    "sessao": 1,
                                                    "enxertos": {
                                                        "valor": 2850,
                                                        "unidade": "enxertos"
                                                    },
                                                    "densidade_antes": {
                                                        "valor": 75,
                                                        "unidade": "UF/cm²"
                                                    },
                                                    "densidade_depois": {
                                                        "valor": 60,
                                                        "unidade": "UF/cm²"
                                                    }
                                                },
                                                {
                                                    "sessao": 2,
                                                    "enxertos": {
                                                        "valor": 1900,
                                                        "unidade": "enxertos"
                                                    },
                                                    "densidade_antes": {
                                                        "valor": 60,
                                                        "unidade": "UF/cm²"
                                                    },
                                                    "densidade_depois": {
                                                        "valor": 50,
                                                        "unidade": "UF/cm²"
                                                    }
                                                }
                                            ],
                                            "propostas": [
                                                {
                                                    "codigo": "baixar_coroa",
                                                    "ordem": 1,
                                                    "efeito": {
                                                        "valor": 350,
                                                        "unidade": "enxertos"
                                                    },
                                                    "balanco_depois": {
                                                        "valor": -525,
                                                        "unidade": "enxertos"
                                                    },
                                                    "disponivel": true
                                                }
                                            ],
                                            "avisos": [
                                                {
                                                    "codigo": "limite_dador",
                                                    "nivel": "aviso",
                                                    "texto": "Défice de 875 enxertos face à capacidade dadora.",
                                                    "campo": null
                                                }
                                            ]
                                        },
                                        "gravado": false
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/planos/{id}/comparar": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "compararEnxertos",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "ver",
                "summary": "Compare graft numbers",
                "description": "For N grafts: coverage of the need, density per zone, sessions and what remains in the donor; unavailable (with reason) above capacity.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "enxertos": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 20000
                                    },
                                    "estado": {
                                        "$ref": "#/components/schemas/EntradaCalculo"
                                    }
                                },
                                "required": [
                                    "enxertos"
                                ]
                            },
                            "example": {
                                "enxertos": 2500
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Comparacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "enxertos": {
                                            "valor": 2500,
                                            "unidade": "enxertos"
                                        },
                                        "cobertura": {
                                            "valor": 44.4,
                                            "unidade": "%"
                                        },
                                        "sessoes": {
                                            "valor": 1,
                                            "unidade": "sessões"
                                        },
                                        "disponivel": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}/diferencas": {
            "get": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "diferencasPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "ver",
                "summary": "Differences between versions",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "com",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Other version of the same plan"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "a": {
                                                    "type": "object"
                                                },
                                                "b": {
                                                    "type": "object"
                                                },
                                                "diferencas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "grupo": {
                                                                "type": "string"
                                                            },
                                                            "rotulo": {
                                                                "type": "string"
                                                            },
                                                            "antes": [],
                                                            "depois": [],
                                                            "unidade": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}/expectativas/mostradas": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "expectativasMostradas",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Record the comparison shown to the patient",
                "description": "Stores who, when, the channel and the exact SHA-256 of what was shown. Only with the approved text.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "presencial",
                                            "teleconsulta",
                                            "portal"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "canal": "presencial"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/AnalisePlano"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}/perda-futura": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "historiaFamiliarPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Family history (yes, no or unknown)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "historia_familiar": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "historia_familiar": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/AnalisePlano"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}/proporcoes": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "proporcoesFaciais",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Propose the facial thirds on a frontal photo",
                "description": "Vision AI proposal (proporcoes use; requires «ia» consent; needs the face, so it is not blurred). Pending until decided.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "foto_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "foto_id"
                                ]
                            },
                            "example": {
                                "foto_id": 3321
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/AnaliseProporcoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/planos/{id}/proposta": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "criarPropostaDoPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "summary": "Create the proposal from the approved plan",
                "description": "Approved plans only; uses the commercial service. 422 when the commercial module is not installed.",
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "proposta_id": {
                                                    "type": "integer"
                                                },
                                                "ligacao": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "proposta_id": 91,
                                        "ligacao": {
                                            "web": "equipa/r/propostas/91",
                                            "app": "/r/propostas/91"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}/simulacao": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "carregarSimulacao",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Upload the simulated image",
                "description": "Image validated by content, stored encrypted and flagged «simulation» (never usable in marketing). Resets «shown» and «acknowledgement».",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Simulacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}/simulacao-ia": {
            "get": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "simulacaoIaEstado",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "ver",
                "summary": "AI-generated simulation: state, base photos and images",
                "description": "Team only. Whether generation is configured, whether the patient gave the «ia» consent, whether the face may be sent visible (consent + clinic option), the three scenarios, the front/top base photos and the generated images (newest first) with their validation state.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SimulacaoIaEstado"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/planos/{id}/simulacao-ia/gerar": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "simulacaoIaGerar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "x-anagen-limite": "12 pedidos / 10 min",
                "summary": "Generate one scenario's simulation from a photo",
                "description": "One image per request (may take minutes). Requires the «ia» consent; the face is blurred before sending (unless consent + clinic option); image AI of the «simulacao» use (local service first, external fallback only with the patient-data switch); the image must start from the photo (similarity ≥ 50 %). Stored as an encrypted clinical file and a «simulation» photo with the visible mark burned in; state «por_validar». 422 with the reason when it cannot generate.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "cenario": {
                                        "type": "string",
                                        "enum": [
                                            "conservador",
                                            "provavel",
                                            "agressivo"
                                        ]
                                    },
                                    "foto_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "cenario",
                                    "foto_id"
                                ]
                            },
                            "example": {
                                "cenario": "provavel",
                                "foto_id": 5521
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SimulacaoIaEstado"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/planos/{id}/simulacao-ia/video": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "simulacaoIaVideo",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "ver",
                "summary": "Record the simulation video export",
                "description": "The video (before/after or 3D model rotation) is recorded on the device and never goes through the server; this request only records it in the audit trail.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "origem": {
                                        "type": "string",
                                        "enum": [
                                            "antes_depois",
                                            "modelo3d",
                                            "animacao_app"
                                        ]
                                    },
                                    "formato": {
                                        "type": "string",
                                        "enum": [
                                            "webm",
                                            "mp4",
                                            "animacao"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "origem": "antes_depois",
                                "formato": "webm"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "registado": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/planos/{id}/simulacao/conhecimento": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "simulacaoConhecimento",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "paciente": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Acknowledge the simulation notice",
                "description": "Team: in-person record (edit ficha.plano). Patient (portal/app): own approved plan only; channel «portal» or «app». «sign» audit with the notice text and the image SHA-256.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "presencial",
                                            "portal",
                                            "app"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "canal": "app"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Simulacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}/simulacao/mostrada": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "simulacaoMostrada",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Record that the simulation was shown",
                "description": "Approved plan. Checks the image SHA-256 (exact archived version) and records who showed it and when.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Simulacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}/submeter": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "submeterPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Submit for medical review",
                "description": "Recalculates and saves; refuses (422) if blocked. The draft becomes «under review» (frozen) and the patient's doctor is notified.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PlanoEditor"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}/usar-real": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "usarRealNoPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Use the actual hairs per graft in the draft",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "plano_id": {
                                                    "type": "integer"
                                                },
                                                "subzonas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "resultado": {
                                                    "$ref": "#/components/schemas/ResultadoMotor"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/planos/{id}/versao": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "novaVersaoPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "New version (editable copy)",
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PlanoEditor"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/plataforma/apresentacao/blocos": {
            "get": {
                "summary": "AnagenSys presentation blocks",
                "description": "Reserved for product management (403 for clinic accounts). Data always lives in the main clinic. meta.paginas has the publication status in pt and en.",
                "parameters": [
                    {
                        "name": "idioma",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pt",
                                "en"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/SiteBloco"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "idioma": {
                                                    "type": "string"
                                                },
                                                "paginas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "idioma": {
                                                                "type": "string"
                                                            },
                                                            "publicada": {
                                                                "type": "boolean"
                                                            },
                                                            "versao": {
                                                                "type": "integer"
                                                            },
                                                            "publicada_em": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 214,
                                            "pagina": "apresentacao",
                                            "chave": "hero_titulo",
                                            "idioma": "pt",
                                            "tipo": "texto",
                                            "seccao": "hero",
                                            "rotulo": "Título principal",
                                            "ajuda": "Use *asteriscos* para o itálico.",
                                            "valor": "Da primeira mensagem ao resultado aos 18 meses, *num só sistema*.",
                                            "campos": null,
                                            "imagem": null,
                                            "personalizado": false,
                                            "atualizado_em": "2026-10-28 11:20:00",
                                            "ordem": 1
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaApresentacaoBlocos",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            },
            "put": {
                "summary": "Save a presentation block",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "chave": {
                                        "type": "string"
                                    },
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt",
                                            "en"
                                        ]
                                    },
                                    "valor": {
                                        "description": "According to the block type."
                                    },
                                    "ficheiro_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "chave",
                                    "idioma"
                                ]
                            },
                            "example": {
                                "chave": "hero_nota",
                                "idioma": "pt",
                                "valor": "Demonstração de 45 minutos com a equipa do produto."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SiteBloco"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "pagina": "apresentacao",
                                        "chave": "hero_nota",
                                        "idioma": "pt",
                                        "tipo": "texto",
                                        "seccao": "hero",
                                        "rotulo": "Título principal",
                                        "ajuda": "Use *asteriscos* para o itálico.",
                                        "valor": "Demonstração de 45 minutos com a equipa do produto.",
                                        "campos": null,
                                        "imagem": null,
                                        "personalizado": true,
                                        "atualizado_em": "2026-10-28 11:20:00",
                                        "ordem": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaApresentacaoGuardarBloco",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            }
        },
        "/plataforma/apresentacao/blocos/repor": {
            "post": {
                "summary": "Restore a presentation block",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "chave": {
                                        "type": "string"
                                    },
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt",
                                            "en"
                                        ]
                                    }
                                },
                                "required": [
                                    "chave",
                                    "idioma"
                                ]
                            },
                            "example": {
                                "chave": "hero_nota",
                                "idioma": "pt"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SiteBloco"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "pagina": "apresentacao",
                                        "chave": "hero_nota",
                                        "idioma": "pt",
                                        "tipo": "texto",
                                        "seccao": "hero",
                                        "rotulo": "Título principal",
                                        "ajuda": "Use *asteriscos* para o itálico.",
                                        "valor": "Cabelo natural, *plano transparente*.",
                                        "campos": null,
                                        "imagem": null,
                                        "personalizado": false,
                                        "atualizado_em": "2026-10-28 11:20:00",
                                        "ordem": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaApresentacaoReporBloco",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            }
        },
        "/plataforma/apresentacao/definicoes": {
            "get": {
                "summary": "Presentation settings",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "email_notificacao": {
                                                    "type": "string"
                                                },
                                                "dominio": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "email_notificacao": "produto@anagen.pt",
                                        "dominio": "https://anagen.pt"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaApresentacaoDefinicoes",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            },
            "put": {
                "summary": "Save presentation settings",
                "description": "email_notificacao receives every demo request; dominio is the main address (https:// without path) to which visits on other domains are redirected. Change is audited.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email_notificacao": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "dominio": {
                                        "type": "string",
                                        "pattern": "^https://[a-z0-9.-]+$"
                                    }
                                }
                            },
                            "example": {
                                "email_notificacao": "produto@anagen.pt",
                                "dominio": "https://anagen.pt"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "email_notificacao": {
                                                    "type": "string"
                                                },
                                                "dominio": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "email_notificacao": "produto@anagen.pt",
                                        "dominio": "https://anagen.pt"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaApresentacaoGravarDefinicoes",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            }
        },
        "/plataforma/apresentacao/imagens": {
            "get": {
                "summary": "Presentation image library",
                "description": "Main clinic images used in the presentation (for example, the social sharing image).",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 100
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/SiteImagem"
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 37,
                                            "nome": "9f1c2a7e4b0d4c1e8a3f6b2d5c7e9a10.webp",
                                            "url": "https://clinica.exemplo.pt/uploads/site/c1/9f1c2a7e4b0d4c1e8a3f6b2d5c7e9a10.webp",
                                            "mime": "image/webp",
                                            "largura": 2400,
                                            "altura": 1600,
                                            "tamanho": 318422,
                                            "alt_pt": "Sala de consulta da clínica",
                                            "alt_en": "The clinic's consultation room",
                                            "usos": 2,
                                            "criado_em": "2026-10-28T09:12:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaApresentacaoImagens",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            },
            "post": {
                "summary": "Upload a presentation image",
                "description": "Multipart, with the same checks as the CMS (bytes, dimensions, rewrite without metadata, random name). Limit: 60 per 10 minutes.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "alt_pt": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "alt_en": {
                                        "type": "string",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SiteImagem"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 37,
                                        "nome": "9f1c2a7e4b0d4c1e8a3f6b2d5c7e9a10.webp",
                                        "url": "https://clinica.exemplo.pt/uploads/site/c1/9f1c2a7e4b0d4c1e8a3f6b2d5c7e9a10.webp",
                                        "mime": "image/webp",
                                        "largura": 2400,
                                        "altura": 1600,
                                        "tamanho": 318422,
                                        "alt_pt": "Sala de consulta da clínica",
                                        "alt_en": "The clinic's consultation room",
                                        "usos": 2,
                                        "criado_em": "2026-10-28T09:12:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaApresentacaoCarregarImagem",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            }
        },
        "/plataforma/apresentacao/imagens/{id}": {
            "delete": {
                "summary": "Delete an unused image",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "apagada": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 37,
                                        "apagada": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaApresentacaoApagarImagem",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            }
        },
        "/plataforma/apresentacao/pedidos": {
            "get": {
                "summary": "Demo request board",
                "description": "Columns by status (new, contacted, demo scheduled, proposal, customer, not pursued, archived), in board order.",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 100
                        },
                        "description": "Search in name, clinic and email."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "colunas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "estado": {
                                                                "type": "string"
                                                            },
                                                            "titulo": {
                                                                "type": "string"
                                                            },
                                                            "tom": {
                                                                "type": "string"
                                                            },
                                                            "cartoes": {
                                                                "type": "array",
                                                                "items": {
                                                                    "$ref": "#/components/schemas/ApresentacaoPedidoCartao"
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "colunas": [
                                            {
                                                "estado": "demonstracao_marcada",
                                                "titulo": "Demonstração marcada",
                                                "tom": "marca",
                                                "cartoes": [
                                                    {
                                                        "id": 58,
                                                        "nome": "Marta Ribeiro",
                                                        "clinica_nome": "Clínica Capilar do Norte",
                                                        "especialidade": "capilar",
                                                        "especialidade_rotulo": "Cirurgia capilar",
                                                        "pais": "PT",
                                                        "cirurgias_mes": 24,
                                                        "estado": "demonstracao_marcada",
                                                        "estado_rotulo": "Demonstração marcada",
                                                        "tom": "marca",
                                                        "responsavel_id": 3,
                                                        "responsavel_nome": "Pedro Almeida",
                                                        "demonstracao_em": "2026-11-05T15:00:00+00:00",
                                                        "criado_em": "2026-10-27T18:40:00+00:00",
                                                        "ordem": 0
                                                    }
                                                ]
                                            }
                                        ],
                                        "total": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaPedidosQuadro",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            }
        },
        "/plataforma/apresentacao/pedidos/{id}": {
            "get": {
                "summary": "One demo request",
                "description": "Read is audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ApresentacaoPedido"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 58,
                                        "nome": "Marta Ribeiro",
                                        "clinica_nome": "Clínica Capilar do Norte",
                                        "especialidade": "capilar",
                                        "especialidade_rotulo": "Cirurgia capilar",
                                        "pais": "PT",
                                        "cirurgias_mes": 24,
                                        "estado": "demonstracao_marcada",
                                        "estado_rotulo": "Demonstração marcada",
                                        "tom": "marca",
                                        "responsavel_id": 3,
                                        "responsavel_nome": "Pedro Almeida",
                                        "demonstracao_em": "2026-11-05T15:00:00+00:00",
                                        "criado_em": "2026-10-27T18:40:00+00:00",
                                        "ordem": 0,
                                        "cargo": "Diretora clínica",
                                        "email": "marta@capilarnorte.pt",
                                        "telefone": "+351 912 345 678",
                                        "cirurgioes_n": 2,
                                        "sistemas_atuais": "Agenda em folha de cálculo e um programa de faturação",
                                        "mensagem": "Gostaríamos de ver o planeamento e o portal do paciente.",
                                        "idioma": "pt",
                                        "origem": "site",
                                        "utm": {
                                            "source": "linkedin",
                                            "campaign": "outono"
                                        },
                                        "consentimento_em": "2026-10-27T18:40:00+00:00",
                                        "notas": "Ligar depois das 17h.",
                                        "responsaveis": [
                                            {
                                                "id": 3,
                                                "nome": "Pedro Almeida"
                                            }
                                        ],
                                        "estados": [
                                            {
                                                "valor": "novo",
                                                "rotulo": "Novo"
                                            },
                                            {
                                                "valor": "contactado",
                                                "rotulo": "Contactado"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaPedido",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            },
            "put": {
                "summary": "Update a request",
                "description": "Partial fields: estado, responsavel_id, demonstracao_em, notas and contact details. Scheduling the demo on a «novo» or «contactado» request moves it to «demonstracao_marcada». Change is audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "novo",
                                            "contactado",
                                            "demonstracao_marcada",
                                            "proposta",
                                            "ganho",
                                            "perdido",
                                            "arquivado"
                                        ]
                                    },
                                    "responsavel_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "demonstracao_em": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time"
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 8000
                                    }
                                }
                            },
                            "example": {
                                "responsavel_id": 3,
                                "demonstracao_em": "2026-11-05T15:00:00+00:00",
                                "notas": "Ligar depois das 17h."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ApresentacaoPedido"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 58,
                                        "nome": "Marta Ribeiro",
                                        "clinica_nome": "Clínica Capilar do Norte",
                                        "especialidade": "capilar",
                                        "especialidade_rotulo": "Cirurgia capilar",
                                        "pais": "PT",
                                        "cirurgias_mes": 24,
                                        "estado": "demonstracao_marcada",
                                        "estado_rotulo": "Demonstração marcada",
                                        "tom": "marca",
                                        "responsavel_id": 3,
                                        "responsavel_nome": "Pedro Almeida",
                                        "demonstracao_em": "2026-11-05T15:00:00+00:00",
                                        "criado_em": "2026-10-27T18:40:00+00:00",
                                        "ordem": 0,
                                        "cargo": "Diretora clínica",
                                        "email": "marta@capilarnorte.pt",
                                        "telefone": "+351 912 345 678",
                                        "cirurgioes_n": 2,
                                        "sistemas_atuais": "Agenda em folha de cálculo e um programa de faturação",
                                        "mensagem": "Gostaríamos de ver o planeamento e o portal do paciente.",
                                        "idioma": "pt",
                                        "origem": "site",
                                        "utm": {
                                            "source": "linkedin",
                                            "campaign": "outono"
                                        },
                                        "consentimento_em": "2026-10-27T18:40:00+00:00",
                                        "notas": "Ligar depois das 17h.",
                                        "responsaveis": [
                                            {
                                                "id": 3,
                                                "nome": "Pedro Almeida"
                                            }
                                        ],
                                        "estados": [
                                            {
                                                "valor": "novo",
                                                "rotulo": "Novo"
                                            },
                                            {
                                                "valor": "contactado",
                                                "rotulo": "Contactado"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaAtualizarPedido",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            }
        },
        "/plataforma/apresentacao/pedidos/{id}/mover": {
            "post": {
                "summary": "Move a request on the board",
                "description": "Changes status and position (order from 0); the target column is renumbered.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "novo",
                                            "contactado",
                                            "demonstracao_marcada",
                                            "proposta",
                                            "ganho",
                                            "perdido",
                                            "arquivado"
                                        ]
                                    },
                                    "ordem": {
                                        "type": "integer",
                                        "minimum": 0
                                    }
                                },
                                "required": [
                                    "estado"
                                ]
                            },
                            "example": {
                                "estado": "proposta",
                                "ordem": 0
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ApresentacaoPedido"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 58,
                                        "nome": "Marta Ribeiro",
                                        "clinica_nome": "Clínica Capilar do Norte",
                                        "especialidade": "capilar",
                                        "especialidade_rotulo": "Cirurgia capilar",
                                        "pais": "PT",
                                        "cirurgias_mes": 24,
                                        "estado": "proposta",
                                        "estado_rotulo": "Proposta enviada",
                                        "tom": "ouro",
                                        "responsavel_id": 3,
                                        "responsavel_nome": "Pedro Almeida",
                                        "demonstracao_em": "2026-11-05T15:00:00+00:00",
                                        "criado_em": "2026-10-27T18:40:00+00:00",
                                        "ordem": 0,
                                        "cargo": "Diretora clínica",
                                        "email": "marta@capilarnorte.pt",
                                        "telefone": "+351 912 345 678",
                                        "cirurgioes_n": 2,
                                        "sistemas_atuais": "Agenda em folha de cálculo e um programa de faturação",
                                        "mensagem": "Gostaríamos de ver o planeamento e o portal do paciente.",
                                        "idioma": "pt",
                                        "origem": "site",
                                        "utm": {
                                            "source": "linkedin",
                                            "campaign": "outono"
                                        },
                                        "consentimento_em": "2026-10-27T18:40:00+00:00",
                                        "notas": "Ligar depois das 17h.",
                                        "responsaveis": [
                                            {
                                                "id": 3,
                                                "nome": "Pedro Almeida"
                                            }
                                        ],
                                        "estados": [
                                            {
                                                "valor": "novo",
                                                "rotulo": "Novo"
                                            },
                                            {
                                                "valor": "contactado",
                                                "rotulo": "Contactado"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaMoverPedido",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            }
        },
        "/plataforma/apresentacao/publicar": {
            "post": {
                "summary": "Publish or unpublish the presentation in one language",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt",
                                            "en"
                                        ]
                                    },
                                    "publicar": {
                                        "type": "boolean"
                                    },
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255
                                    }
                                },
                                "required": [
                                    "idioma"
                                ]
                            },
                            "example": {
                                "idioma": "en",
                                "publicar": true,
                                "motivo": "Nova secção de integrações"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "publicada": {
                                                    "type": "boolean"
                                                },
                                                "versao": {
                                                    "type": "integer"
                                                },
                                                "publicada_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "publicada": true,
                                        "versao": 5,
                                        "publicada_em": "2026-10-28T12:40:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Plataforma — Apresentação"
                ],
                "operationId": "plataformaApresentacaoPublicar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.apresentacao",
                "x-anagen-nivel": "plataforma"
            }
        },
        "/plataforma/operacao": {
            "get": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "estadoDaPlataforma",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "ver",
                "summary": "Platform status",
                "description": "Points of attention ordered by severity, environment, backups, restores, vulnerabilities, dependencies, hosting, security.txt and versions. Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EstadoPlataforma"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/plataforma/operacao/atividades": {
            "get": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "listarAtividadesOperacao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "ver",
                "summary": "Penetration tests, exercises and reviews",
                "description": " Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "parameters": [
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "teste_intrusao",
                                "exercicio_continuidade",
                                "teste_restauro_manual",
                                "revisao_dependencias",
                                "revisao_asvs",
                                "revisao_acessos",
                                "outro"
                            ]
                        }
                    },
                    {
                        "name": "pagina",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/AtividadeOperacao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "criarAtividadeOperacao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "editar",
                "summary": "Record an activity",
                "description": "n_<severity> = number of findings per severity (tests and reviews); measured rpo_minutos/rto_minutos (exercises). Without proxima_em: penetration +12 months (settings), exercise +6, dependency review +1, ASVS +12, access +3. Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "teste_intrusao",
                                            "exercicio_continuidade",
                                            "teste_restauro_manual",
                                            "revisao_dependencias",
                                            "revisao_asvs",
                                            "revisao_acessos",
                                            "outro"
                                        ]
                                    },
                                    "titulo": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "realizada_em": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "resultado": {
                                        "type": "string",
                                        "enum": [
                                            "sem_constatacoes",
                                            "com_constatacoes",
                                            "parcial",
                                            "falhou",
                                            "concluido"
                                        ]
                                    },
                                    "entidade": {
                                        "type": "string",
                                        "maxLength": 190
                                    },
                                    "ambito": {
                                        "type": "string",
                                        "maxLength": 500
                                    },
                                    "proxima_em": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "n_critica": {
                                        "type": "integer"
                                    },
                                    "n_alta": {
                                        "type": "integer"
                                    },
                                    "n_media": {
                                        "type": "integer"
                                    },
                                    "n_baixa": {
                                        "type": "integer"
                                    },
                                    "n_info": {
                                        "type": "integer"
                                    },
                                    "rpo_minutos": {
                                        "type": "integer"
                                    },
                                    "rto_minutos": {
                                        "type": "integer"
                                    },
                                    "notas": {
                                        "type": "string",
                                        "maxLength": 5000
                                    }
                                },
                                "required": [
                                    "tipo",
                                    "titulo",
                                    "realizada_em",
                                    "resultado"
                                ]
                            },
                            "example": {
                                "tipo": "exercicio_continuidade",
                                "titulo": "Restauro completo num servidor novo",
                                "realizada_em": "2026-10-29",
                                "resultado": "concluido",
                                "rpo_minutos": 1440,
                                "rto_minutos": 210
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/AtividadeOperacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/plataforma/operacao/copias": {
            "get": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "listarCopias",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "ver",
                "summary": "Backups",
                "description": " Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "parameters": [
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pedida",
                                "em_curso",
                                "ok",
                                "erro"
                            ]
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "diaria",
                                "semanal",
                                "mensal",
                                "manual"
                            ]
                        }
                    },
                    {
                        "name": "pagina",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "por_pagina",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 100
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/CopiaSeguranca"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "pagina": {
                                                    "type": "integer"
                                                },
                                                "por_pagina": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 214,
                                            "origem": "automatica",
                                            "origem_rotulo": "automática",
                                            "tipo": "diaria",
                                            "tipo_rotulo": "Diária",
                                            "estado": "ok",
                                            "estado_rotulo": "Concluída",
                                            "estado_tom": "sucesso",
                                            "iniciada_em": "2026-10-29T02:30:04+00:00",
                                            "terminada_em": "2026-10-29T02:41:52+00:00",
                                            "duracao_legivel": "11 min 48 s",
                                            "nome": "anagensys-20261029-023004-diaria-214.axc",
                                            "tamanho": 1873420288,
                                            "tamanho_legivel": "1,7 GB",
                                            "sha256": "9b1e…c04f",
                                            "metodo_dump": "binario",
                                            "base_dados": {
                                                "tabelas": 186,
                                                "linhas": 2410377,
                                                "bytes": 402653184
                                            },
                                            "ficheiros": {
                                                "total": 18842,
                                                "bytes": 1610612736,
                                                "bytes_legiveis": "1,5 GB"
                                            },
                                            "local": true,
                                            "verificacao_estado": "ok",
                                            "destino_tipo": "s3",
                                            "destino_estado": "enviada",
                                            "destino_estado_rotulo": "Enviada",
                                            "imutavel": true,
                                            "retencao_ate": "2026-12-03T02:41:58+00:00",
                                            "ligacao": {
                                                "web": "equipa/plataforma/operacao/copias/214",
                                                "app": "/e/estado_plataforma?copia=214"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/plataforma/operacao/copias/pedir": {
            "post": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "pedirCopia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "editar",
                "summary": "Request a backup now",
                "description": "Creates a «pedida» (manual) request the scheduler runs within minutes. If a request or backup is already pending, returns it. 6 requests per 10 minutes. Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "maxLength": 255
                                    }
                                }
                            },
                            "example": {
                                "motivo": "Antes da atualização da versão"
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Request accepted (queued for the scheduler)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CopiaSeguranca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    },
                    "409": {
                        "description": "State does not allow it (conflict)"
                    }
                }
            }
        },
        "/plataforma/operacao/copias/{id}": {
            "get": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "obterCopia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "ver",
                "summary": "One backup, with its restore tests",
                "description": " Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/CopiaSeguranca"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "restauros": {
                                                            "type": "array",
                                                            "items": {
                                                                "$ref": "#/components/schemas/TesteRestauro"
                                                            }
                                                        }
                                                    }
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "origem": "automatica",
                                        "origem_rotulo": "automática",
                                        "tipo": "diaria",
                                        "tipo_rotulo": "Diária",
                                        "estado": "ok",
                                        "estado_rotulo": "Concluída",
                                        "estado_tom": "sucesso",
                                        "iniciada_em": "2026-10-29T02:30:04+00:00",
                                        "terminada_em": "2026-10-29T02:41:52+00:00",
                                        "duracao_legivel": "11 min 48 s",
                                        "nome": "anagensys-20261029-023004-diaria-214.axc",
                                        "tamanho": 1873420288,
                                        "tamanho_legivel": "1,7 GB",
                                        "sha256": "9b1e…c04f",
                                        "metodo_dump": "binario",
                                        "base_dados": {
                                            "tabelas": 186,
                                            "linhas": 2410377,
                                            "bytes": 402653184
                                        },
                                        "ficheiros": {
                                            "total": 18842,
                                            "bytes": 1610612736,
                                            "bytes_legiveis": "1,5 GB"
                                        },
                                        "local": true,
                                        "verificacao_estado": "ok",
                                        "destino_tipo": "s3",
                                        "destino_estado": "enviada",
                                        "destino_estado_rotulo": "Enviada",
                                        "imutavel": true,
                                        "retencao_ate": "2026-12-03T02:41:58+00:00",
                                        "ligacao": {
                                            "web": "equipa/plataforma/operacao/copias/214",
                                            "app": "/e/estado_plataforma?copia=214"
                                        },
                                        "restauros": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/plataforma/operacao/copias/{id}/enviar": {
            "post": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "enviarCopia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "editar",
                "summary": "Request upload to the external destination",
                "description": "Marks the backup «por_enviar»; the scheduler uploads it (with object lock when enabled). Never overwrites or deletes at the destination. Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Request accepted (queued for the scheduler)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CopiaSeguranca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    },
                    "409": {
                        "description": "Already uploaded, no local file or not completed"
                    }
                }
            }
        },
        "/plataforma/operacao/copias/{id}/verificar": {
            "post": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "verificarCopia",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "editar",
                "summary": "Request an integrity check",
                "description": "SHA-256 fingerprint of the file, HMAC signature of the manifest, full decryption with the content digest and, with a destination, presence and size at the destination. Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Request accepted (queued for the scheduler)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CopiaSeguranca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    },
                    "409": {
                        "description": "Backup not found or not completed"
                    }
                }
            }
        },
        "/plataforma/operacao/destino/testar": {
            "post": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "testarDestinoCopias",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "editar",
                "summary": "Test the external destination connection",
                "description": "Without writing anything: credentials, remote folder, SFTP server fingerprint, bucket object lock. 422 sem_destino when there is no destination. Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "detalhes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "mensagem": "Ligação ao destino confirmada.",
                                        "detalhes": [
                                            "O contentor tem o bloqueio de objetos ativo."
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/plataforma/operacao/restauros/pedir": {
            "post": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "pedirTesteRestauro",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "editar",
                "summary": "Request a restore test",
                "description": "Restores the given backup (or the latest valid one) into a separate schema configured on the server, compares tables and rows with the manifest, checks a sample of files and drops the schema at the end. Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "copia_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Request accepted (queued for the scheduler)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/TesteRestauro"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    },
                    "409": {
                        "description": "Backup not found"
                    }
                }
            }
        },
        "/plataforma/operacao/restauros/{id}": {
            "get": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "obterTesteRestauro",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "ver",
                "summary": "One restore test",
                "description": " Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/TesteRestauro"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/plataforma/operacao/vulnerabilidades": {
            "get": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "listarVulnerabilidades",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "ver",
                "summary": "Vulnerabilities",
                "description": "By severity and deadline. f[estado]: abertas (default), todas or a state. meta.opcoes has the labelled lists. Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "parameters": [
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "abertas",
                                "todas",
                                "aberta",
                                "em_correcao",
                                "corrigida",
                                "aceite",
                                "falso_positivo"
                            ]
                        }
                    },
                    {
                        "name": "f[gravidade]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "critica",
                                "alta",
                                "media",
                                "baixa",
                                "info"
                            ]
                        }
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "composer_audit",
                                "pub_outdated",
                                "teste_intrusao",
                                "divulgacao",
                                "revisao_interna",
                                "asvs",
                                "outro"
                            ]
                        }
                    },
                    {
                        "name": "f[fora_prazo]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        }
                    },
                    {
                        "name": "pagina",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "por_pagina",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 100
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Vulnerabilidade"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "criarVulnerabilidade",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "editar",
                "summary": "Record a vulnerability",
                "description": "Without prazo_em, the deadline is the detection date plus the days for the severity (platform settings). Description and notes are stored encrypted. Audited. Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "titulo": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "gravidade": {
                                        "type": "string",
                                        "enum": [
                                            "critica",
                                            "alta",
                                            "media",
                                            "baixa",
                                            "info"
                                        ]
                                    },
                                    "origem": {
                                        "type": "string",
                                        "enum": [
                                            "composer_audit",
                                            "pub_outdated",
                                            "teste_intrusao",
                                            "divulgacao",
                                            "revisao_interna",
                                            "asvs",
                                            "outro"
                                        ]
                                    },
                                    "superficie": {
                                        "type": "string",
                                        "enum": [
                                            "servidor",
                                            "app",
                                            "infraestrutura",
                                            "processo"
                                        ]
                                    },
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "aberta",
                                            "em_correcao",
                                            "corrigida",
                                            "aceite",
                                            "falso_positivo"
                                        ]
                                    },
                                    "referencia": {
                                        "type": "string",
                                        "pattern": "^[A-Za-z0-9._:\\-]{2,80}$"
                                    },
                                    "componente": {
                                        "type": "string",
                                        "maxLength": 190
                                    },
                                    "versao": {
                                        "type": "string",
                                        "maxLength": 60
                                    },
                                    "detetada_em": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "prazo_em": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "descricao": {
                                        "type": "string",
                                        "maxLength": 10000
                                    },
                                    "notas": {
                                        "type": "string",
                                        "maxLength": 5000
                                    },
                                    "responsavel_id": {
                                        "type": "integer"
                                    },
                                    "atividade_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "titulo",
                                    "gravidade",
                                    "origem"
                                ]
                            },
                            "example": {
                                "titulo": "Cabeçalho de segurança em falta numa página pública",
                                "gravidade": "media",
                                "origem": "teste_intrusao",
                                "superficie": "servidor",
                                "atividade_id": 3
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Vulnerabilidade"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/plataforma/operacao/vulnerabilidades/{id}": {
            "get": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "obterVulnerabilidade",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "ver",
                "summary": "One vulnerability (with description and notes)",
                "description": " Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Vulnerabilidade"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "put": {
                "tags": [
                    "Operação da plataforma"
                ],
                "operationId": "alterarVulnerabilidade",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.operacao",
                "x-anagen-nivel": "editar",
                "summary": "Update a vulnerability",
                "description": "Same fields as creation (only those sent change). Fixed, accepted or false positive close it with the resolution date. Reserved to platform super administrators (403 so_superadmin / segundo_fator_necessario for everyone else, including clinic administrators).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "aberta",
                                            "em_correcao",
                                            "corrigida",
                                            "aceite",
                                            "falso_positivo"
                                        ]
                                    },
                                    "notas": {
                                        "type": "string"
                                    }
                                }
                            },
                            "example": {
                                "estado": "corrigida"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Vulnerabilidade"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/plataforma/seguranca": {
            "get": {
                "tags": [
                    "Segurança da plataforma"
                ],
                "operationId": "segurancaPainel",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.seguranca",
                "x-anagen-nivel": "editar",
                "summary": "Sign-in shield panel (24 h)",
                "description": "Reserved to platform management (403 for everyone else, including clinic administrators). Global infrastructure tables.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "disponivel": {
                                                    "type": "boolean"
                                                },
                                                "ligado": {
                                                    "type": "boolean"
                                                },
                                                "estado": {
                                                    "type": "object"
                                                },
                                                "totais": {
                                                    "type": "object"
                                                },
                                                "serie": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "niveis": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "contas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "origens": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "bloqueios": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "alertas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "politica": {
                                                    "type": "object"
                                                },
                                                "gerado_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "estado": {
                                            "nivel": 0,
                                            "chave": "normal",
                                            "rotulo": "Normal",
                                            "falhas_5min": 2,
                                            "limite_anomalo": 20,
                                            "limite_ataque": 60
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/plataforma/seguranca/bloquear": {
            "post": {
                "tags": [
                    "Segurança da plataforma"
                ],
                "operationId": "segurancaBloquear",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.seguranca",
                "x-anagen-nivel": "editar",
                "summary": "Block an address",
                "description": "hours 0 or missing = until someone unblocks it. Never the requester’s own address.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "ip": {
                                        "type": "string"
                                    },
                                    "nota": {
                                        "type": "string"
                                    },
                                    "horas": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "ip"
                                ]
                            },
                            "example": {
                                "ip": "203.0.113.7",
                                "horas": 48,
                                "nota": "Rede de robôs"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/plataforma/seguranca/conta/{conta}": {
            "get": {
                "tags": [
                    "Segurança da plataforma"
                ],
                "operationId": "segurancaConta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.seguranca",
                "x-anagen-nivel": "editar",
                "summary": "Account sheet (blind index of the email)",
                "parameters": [
                    {
                        "name": "conta",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/plataforma/seguranca/desbloquear": {
            "post": {
                "tags": [
                    "Segurança da plataforma"
                ],
                "operationId": "segurancaDesbloquear",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.seguranca",
                "x-anagen-nivel": "editar",
                "summary": "Unblock an address",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "ip": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "ip"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/plataforma/seguranca/libertar": {
            "post": {
                "tags": [
                    "Segurança da plataforma"
                ],
                "operationId": "segurancaLibertar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.seguranca",
                "x-anagen-nivel": "editar",
                "summary": "Release an account from its wait",
                "description": "The failure count restarts; logged in the audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "conta": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$"
                                    }
                                },
                                "required": [
                                    "conta"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/plataforma/seguranca/origem": {
            "get": {
                "tags": [
                    "Segurança da plataforma"
                ],
                "operationId": "segurancaOrigem",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.seguranca",
                "x-anagen-nivel": "editar",
                "summary": "Origin (address) sheet",
                "parameters": [
                    {
                        "name": "ip",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/plataforma/seguranca/politica": {
            "put": {
                "tags": [
                    "Segurança da plataforma"
                ],
                "operationId": "segurancaPolitica",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "plataforma.seguranca",
                "x-anagen-nivel": "editar",
                "summary": "Save the shield policy",
                "description": "Fields: ativo, bits_base (12–22), limite_anomalo, limite_ataque, conta_livres, espera_base (s), espera_maxima (s), janela_conta (min), bloqueio_tentativas, bloqueio_horas, dispositivo_dias, aviso_dispositivo_novo, alerta_emails (list), escudo_dias. Platform values (stored on clinic 1).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "ativo": {
                                        "type": "boolean"
                                    },
                                    "bits_base": {
                                        "type": "integer"
                                    },
                                    "limite_anomalo": {
                                        "type": "integer"
                                    },
                                    "limite_ataque": {
                                        "type": "integer"
                                    },
                                    "conta_livres": {
                                        "type": "integer"
                                    },
                                    "espera_base": {
                                        "type": "integer"
                                    },
                                    "espera_maxima": {
                                        "type": "integer"
                                    },
                                    "janela_conta": {
                                        "type": "integer"
                                    },
                                    "bloqueio_tentativas": {
                                        "type": "integer"
                                    },
                                    "bloqueio_horas": {
                                        "type": "integer"
                                    },
                                    "dispositivo_dias": {
                                        "type": "integer"
                                    },
                                    "aviso_dispositivo_novo": {
                                        "type": "boolean"
                                    },
                                    "alerta_emails": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "escudo_dias": {
                                        "type": "integer"
                                    }
                                }
                            },
                            "example": {
                                "bits_base": 17,
                                "limite_anomalo": 20,
                                "limite_ataque": 60
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/plataforma/superadmins": {
            "get": {
                "x-anagen-modulo": "plataforma.superadmins",
                "x-anagen-nivel": "ver",
                "tags": [
                    "Superadministradores"
                ],
                "operationId": "listarSuperadmins",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "List superadministrators",
                "description": "Superadministrators with an active second factor only. Other accounts: 403 so_superadmin (or segundo_fator_necessario).",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "ativo",
                                "suspenso",
                                "convidado",
                                "bloqueado"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Superadmin"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "ativos": {
                                                    "type": "integer"
                                                },
                                                "sem_2fa": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            },
            "post": {
                "x-anagen-modulo": "plataforma.superadmins",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Superadministradores"
                ],
                "operationId": "criarSuperadmin",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Create (platform-only account with invitation) or promote",
                "description": "Reason required; audited; the other superadministrators receive an email. Promoting ends the person's sessions.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "modo": {
                                        "type": "string",
                                        "enum": [
                                            "novo",
                                            "promover"
                                        ]
                                    },
                                    "nome": {
                                        "type": "string"
                                    },
                                    "email": {
                                        "type": "string"
                                    },
                                    "utilizador_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 5,
                                        "maxLength": 500
                                    }
                                },
                                "required": [
                                    "modo",
                                    "motivo"
                                ]
                            },
                            "example": {
                                "modo": "novo",
                                "nome": "Tiago Lopes",
                                "email": "tiago@anagen.pt",
                                "motivo": "Responsável técnico da plataforma."
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Superadmin"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/plataforma/superadmins/candidatos": {
            "get": {
                "x-anagen-modulo": "plataforma.superadmins",
                "x-anagen-nivel": "ver",
                "tags": [
                    "Superadministradores"
                ],
                "operationId": "candidatosSuperadmin",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Team members who can be promoted",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "nome": {
                                                        "type": "string"
                                                    },
                                                    "email": {
                                                        "type": "string"
                                                    },
                                                    "clinica_nome": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/plataforma/superadmins/{id}": {
            "get": {
                "x-anagen-modulo": "plataforma.superadmins",
                "x-anagen-nivel": "ver",
                "tags": [
                    "Superadministradores"
                ],
                "operationId": "obterSuperadmin",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Account id."
                    }
                ],
                "summary": "Detail with history",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Superadmin"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "put": {
                "x-anagen-modulo": "plataforma.superadmins",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Superadministradores"
                ],
                "operationId": "editarSuperadmin",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Account id."
                    }
                ],
                "summary": "Edit name, email, phone and language (reason required)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string"
                                    },
                                    "email": {
                                        "type": "string"
                                    },
                                    "telefone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    },
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 5,
                                        "maxLength": 500
                                    }
                                },
                                "required": [
                                    "motivo"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Superadmin"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/plataforma/superadmins/{id}/{acao}": {
            "post": {
                "x-anagen-modulo": "plataforma.superadmins",
                "x-anagen-nivel": "editar",
                "tags": [
                    "Superadministradores"
                ],
                "operationId": "acaoSuperadmin",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Account id."
                    },
                    {
                        "name": "acao",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "suspender",
                                "reativar",
                                "sessoes",
                                "repor-2fa",
                                "retirar",
                                "apagar",
                                "convite"
                            ]
                        }
                    }
                ],
                "summary": "Suspend, reactivate, end sessions, reset 2FA, remove status, delete or resend invitation",
                "description": "Reason required (except convite). Never on your own account (409 proprio) nor on the last active superadministrator (409 ultimo_superadmin). Audited; email to the other superadministrators.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": "string",
                                        "minLength": 5,
                                        "maxLength": 500
                                    }
                                }
                            },
                            "example": {
                                "motivo": "Saída da empresa."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Superadmin"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/portal/acessos": {
            "get": {
                "summary": "Who accessed my data",
                "description": "Source: Auditoria::acessosAoPaciente (immutable log). By default without the patient's own actions (minhas=1 includes them). Summary, chart per day (90 days), people and paginated accesses (25). The reason only appears for emergency accesses.",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "acao",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "pessoa",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "minhas",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        }
                    },
                    {
                        "name": "pagina",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "linhas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalAcesso"
                                                    }
                                                },
                                                "resumo": {
                                                    "type": "object"
                                                },
                                                "grafico": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "x": {
                                                                "type": "string"
                                                            },
                                                            "y": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    }
                                                },
                                                "pessoas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "acoes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "filtros": {
                                                    "type": "object"
                                                },
                                                "opcoes_acao": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "pagina": {
                                                    "type": "integer"
                                                },
                                                "por_pagina": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "linhas": [
                                            {
                                                "id": 99120,
                                                "quando": "2026-10-28T09:41:00+00:00",
                                                "quem": "Dr.ª Inês Valente",
                                                "funcao": "Médico",
                                                "ator_tipo": "utilizador",
                                                "proprio": false,
                                                "acao": "ver",
                                                "acao_rotulo": "Ver",
                                                "area": "Ficha clínica",
                                                "origem": "web",
                                                "origem_rotulo": "Plataforma web",
                                                "emergencia": false,
                                                "motivo": null
                                            }
                                        ],
                                        "resumo": {
                                            "total": 14,
                                            "pessoas": 3,
                                            "emergencias": 0,
                                            "ultimo": "2026-10-28T09:41:00+00:00"
                                        },
                                        "grafico": [
                                            {
                                                "x": "2026-10-28",
                                                "y": 4
                                            }
                                        ],
                                        "pessoas": [
                                            {
                                                "quem": "Dr.ª Inês Valente",
                                                "funcao": "Médico",
                                                "total": 9
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — acessos"
                ],
                "operationId": "portalAcessos",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/auth/codigo": {
            "post": {
                "tags": [
                    "Portal — autenticação"
                ],
                "operationId": "portalPedirCodigo",
                "security": [],
                "summary": "Request a sign-in code by email",
                "description": "The response is the same whether or not the account exists (does not reveal who is a patient).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    }
                                },
                                "required": [
                                    "email"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "validade_minutos": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/portal/auth/consentimentos": {
            "get": {
                "tags": [
                    "Portal — autenticação"
                ],
                "operationId": "portalConsentimentosRegisto",
                "security": [],
                "summary": "Consents to show on registration",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "modelo_id": {
                                                        "type": "integer"
                                                    },
                                                    "finalidade": {
                                                        "type": "string"
                                                    },
                                                    "titulo": {
                                                        "type": "string"
                                                    },
                                                    "texto": {
                                                        "type": "string",
                                                        "description": "HTML"
                                                    },
                                                    "versao": {
                                                        "type": "integer"
                                                    },
                                                    "obrigatorio": {
                                                        "type": "boolean"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/portal/auth/desafio": {
            "post": {
                "tags": [
                    "Escudo de entrada"
                ],
                "operationId": "desafioEscudoPortal",
                "security": [],
                "summary": "Device verification challenge (patient portal)",
                "description": "Same as /auth/desafio, for requesting a code, signing in and registering in the portal. Send X-AX-Clinica with the clinic code.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "dispositivo_confiavel": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "desafio": {
                                                    "type": "string"
                                                },
                                                "salt": {
                                                    "type": "string",
                                                    "pattern": "^[0-9a-f]{32}$"
                                                },
                                                "bits": {
                                                    "type": "integer"
                                                },
                                                "nivel": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 4
                                                },
                                                "valido_por": {
                                                    "type": "integer"
                                                },
                                                "minimo_ms": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "desafio": "eyJ2IjoxLCJpZCI6….9f2c…",
                                        "salt": "3f8a1c0e9b7d4a2f6e5c1b0a9d8e7f60",
                                        "bits": 17,
                                        "nivel": 0,
                                        "valido_por": 300,
                                        "minimo_ms": 0
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/portal/auth/entrar": {
            "post": {
                "tags": [
                    "Portal — autenticação"
                ],
                "operationId": "portalEntrar",
                "security": [],
                "summary": "Portal sign-in (code or password)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "codigo": {
                                        "type": "string"
                                    },
                                    "palavra_passe": {
                                        "type": "string"
                                    },
                                    "dispositivo": {
                                        "type": "string"
                                    },
                                    "plataforma": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "email"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "acesso": {
                                                    "type": "string"
                                                },
                                                "renovacao": {
                                                    "type": "string"
                                                },
                                                "expira_em": {
                                                    "type": "string",
                                                    "format": "date-time"
                                                },
                                                "renovacao_expira_em": {
                                                    "type": "string",
                                                    "format": "date-time"
                                                },
                                                "tipo": {
                                                    "type": "string",
                                                    "enum": [
                                                        "equipa",
                                                        "paciente"
                                                    ]
                                                },
                                                "conta": {
                                                    "type": "object"
                                                },
                                                "codigos_recuperacao": {
                                                    "type": [
                                                        "array",
                                                        "null"
                                                    ],
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/portal/auth/registar": {
            "post": {
                "tags": [
                    "Portal — autenticação"
                ],
                "operationId": "portalRegistar",
                "security": [],
                "summary": "Create a portal account",
                "description": "Creates a pending account and sends a verification email (the account is only active once confirmed). Consents are those returned by GET /portal/auth/consentimentos; mandatory ones must be accepted.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string"
                                    },
                                    "apelidos": {
                                        "type": "string"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "telefone": {
                                        "type": "string"
                                    },
                                    "palavra_passe": {
                                        "type": "string"
                                    },
                                    "idioma": {
                                        "type": "string"
                                    },
                                    "consentimentos": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "boolean"
                                        },
                                        "description": "modelo_id → accepted"
                                    }
                                },
                                "required": [
                                    "nome",
                                    "email",
                                    "palavra_passe"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "verificacao_horas": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/portal/consentimentos": {
            "get": {
                "summary": "Permissions: status, pending and history",
                "description": "Status per purpose (latest decision), templates to sign (requested by the clinic in portal.consentimentos_pedidos, new versions and the surgical consent of the current episode) and immutable history.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "finalidades": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalFinalidade"
                                                    }
                                                },
                                                "pendentes": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalModeloConsentimento"
                                                    }
                                                },
                                                "historico": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "finalidades": [
                                            {
                                                "finalidade": "marketing",
                                                "rotulo": "Comunicações comerciais",
                                                "descricao": "Comunicações sobre novidades e campanhas da clínica.",
                                                "decisao": "dado",
                                                "decisao_rotulo": "Dado",
                                                "em": "2026-09-02T18:11:00+00:00",
                                                "canal": "portal",
                                                "canal_rotulo": "Portal",
                                                "versao": 1,
                                                "obrigatorio": false,
                                                "base_legal": "consentimento",
                                                "base_legal_rotulo": "Consentimento",
                                                "pode_revogar": true,
                                                "pode_dar": false,
                                                "modelo_id": 4
                                            }
                                        ],
                                        "pendentes": [
                                            {
                                                "modelo_id": 12,
                                                "chave": "cirurgico_fue",
                                                "titulo": "Consentimento informado — FUE",
                                                "finalidade": "cirurgico",
                                                "finalidade_rotulo": "Cirúrgico",
                                                "versao": 3,
                                                "obrigatorio": true,
                                                "reflexao_horas": 24,
                                                "informacao_entregue_em": "2026-10-27T10:00:00+00:00",
                                                "pode_assinar_em": "2026-10-28T10:00:00+00:00",
                                                "pode_assinar": true,
                                                "precisa_ler": false,
                                                "motivo": "cirurgico",
                                                "motivo_rotulo": "Antes da cirurgia"
                                            }
                                        ],
                                        "historico": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — autorizações"
                ],
                "operationId": "portalConsentimentos",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/consentimentos/modelos/{id}": {
            "get": {
                "summary": "Consent template text",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Approved template"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalModeloConsentimento"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "modelo_id": 12,
                                        "chave": "cirurgico_fue",
                                        "titulo": "Consentimento informado — FUE",
                                        "finalidade": "cirurgico",
                                        "finalidade_rotulo": "Cirúrgico",
                                        "versao": 3,
                                        "obrigatorio": true,
                                        "reflexao_horas": 24,
                                        "informacao_entregue_em": "2026-10-27T10:00:00+00:00",
                                        "pode_assinar_em": "2026-10-28T10:00:00+00:00",
                                        "pode_assinar": true,
                                        "precisa_ler": false,
                                        "texto": "<p>…</p>",
                                        "campos_dgs": [
                                            {
                                                "chave": "riscos",
                                                "titulo": "Riscos",
                                                "texto": "<p>…</p>"
                                            }
                                        ],
                                        "assinatura": true,
                                        "decisao_atual": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — autorizações"
                ],
                "operationId": "portalModeloConsentimento",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/consentimentos/modelos/{id}/decidir": {
            "post": {
                "summary": "Give or refuse a consent",
                "description": "With a reflection period: requires the reading and the end of the period (409 «reflexao»). Written-consent purposes require the PNG signature. Immutable core row with channel, version and text hash. Effects: notice to doctor/reception for mandatory, surgical and refused consents.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Approved template"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "dado",
                                            "recusado"
                                        ]
                                    },
                                    "assinatura": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "contentEncoding": "base64",
                                        "contentMediaType": "image/png"
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "dado",
                                "assinatura": "data:image/png;base64,iVBORw0KGgo…"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "finalidades": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalFinalidade"
                                                    }
                                                },
                                                "pendentes": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalModeloConsentimento"
                                                    }
                                                },
                                                "historico": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "finalidades": [
                                            {
                                                "finalidade": "marketing",
                                                "rotulo": "Comunicações comerciais",
                                                "descricao": "Comunicações sobre novidades e campanhas da clínica.",
                                                "decisao": "dado",
                                                "decisao_rotulo": "Dado",
                                                "em": "2026-09-02T18:11:00+00:00",
                                                "canal": "portal",
                                                "canal_rotulo": "Portal",
                                                "versao": 1,
                                                "obrigatorio": false,
                                                "base_legal": "consentimento",
                                                "base_legal_rotulo": "Consentimento",
                                                "pode_revogar": true,
                                                "pode_dar": false,
                                                "modelo_id": 4
                                            }
                                        ],
                                        "pendentes": [],
                                        "historico": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — autorizações"
                ],
                "operationId": "portalDecidirConsentimento",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/consentimentos/modelos/{id}/ler": {
            "post": {
                "summary": "Confirm receipt of the information",
                "description": "Records delivery of the information (portal_leituras «informacao_consentimento», once) and starts the template reflection period.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Approved template"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalModeloConsentimento"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "modelo_id": 12,
                                        "chave": "cirurgico_fue",
                                        "titulo": "Consentimento informado — FUE",
                                        "finalidade": "cirurgico",
                                        "finalidade_rotulo": "Cirúrgico",
                                        "versao": 3,
                                        "obrigatorio": true,
                                        "reflexao_horas": 24,
                                        "informacao_entregue_em": "2026-10-27T10:00:00+00:00",
                                        "pode_assinar_em": "2026-10-28T10:00:00+00:00",
                                        "pode_assinar": true,
                                        "precisa_ler": false
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — autorizações"
                ],
                "operationId": "portalLerConsentimento",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/consentimentos/{finalidade}/revogar": {
            "post": {
                "summary": "Withdraw an optional permission",
                "description": "New «revoked» row (the record is never deleted) with immediate effect: Conformidade\\Revogacao::aplicar (M2) or, without it, stopping CRM sequences and withdrawing communication images. Mandatory, clinical treatment and surgical: 409 «nao_revogavel». Effects: notice to administration, portal.consentimento_revogado webhook.",
                "parameters": [
                    {
                        "name": "finalidade",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "fotografias_clinicas",
                                "imagens_comunicacao",
                                "captura_3d",
                                "gravacao_chamadas",
                                "gravacao_video",
                                "ia",
                                "agente_voz",
                                "marketing",
                                "partilha_terceiros",
                                "teleconsulta",
                                "contacto"
                            ]
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 500
                                    }
                                }
                            },
                            "example": {
                                "motivo": null
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "finalidades": [
                                            {
                                                "finalidade": "marketing",
                                                "rotulo": "Comunicações comerciais",
                                                "descricao": "Comunicações sobre novidades e campanhas da clínica.",
                                                "decisao": "revogado",
                                                "decisao_rotulo": "Retirado",
                                                "em": "2026-09-02T18:11:00+00:00",
                                                "canal": "portal",
                                                "canal_rotulo": "Portal",
                                                "versao": 1,
                                                "obrigatorio": false,
                                                "base_legal": "consentimento",
                                                "base_legal_rotulo": "Consentimento",
                                                "pode_revogar": false,
                                                "pode_dar": true,
                                                "modelo_id": 4
                                            }
                                        ],
                                        "pendentes": [],
                                        "historico": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — autorizações"
                ],
                "operationId": "portalRevogarConsentimento",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/cuidados": {
            "get": {
                "tags": [
                    "Portal · Cuidados por fase"
                ],
                "operationId": "portalCuidados",
                "summary": "Available and upcoming content",
                "description": "Day since surgery (follow-up calendar), content already available (newest first, «novo» until opened) and upcoming items with date. 403 funcionalidade_desativada when recovery is turned off.",
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "disponivel": {
                                                    "type": "boolean"
                                                },
                                                "cirurgia_data": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "dia": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "conteudos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "titulo": {
                                                                "type": "string"
                                                            },
                                                            "tipo": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "video",
                                                                    "artigo"
                                                                ]
                                                            },
                                                            "dia": {
                                                                "type": "integer"
                                                            },
                                                            "fase": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "dia0",
                                                                    "semana1",
                                                                    "semanas",
                                                                    "mes1",
                                                                    "meses"
                                                                ]
                                                            },
                                                            "fase_rotulo": {
                                                                "type": "string"
                                                            },
                                                            "resumo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "duracao_segundos": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "tem_video": {
                                                                "type": "boolean"
                                                            },
                                                            "novo": {
                                                                "type": "boolean"
                                                            },
                                                            "disponivel_em": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date"
                                                            },
                                                            "bloqueado": {
                                                                "type": "boolean"
                                                            }
                                                        }
                                                    }
                                                },
                                                "proximos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "titulo": {
                                                                "type": "string"
                                                            },
                                                            "tipo": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "video",
                                                                    "artigo"
                                                                ]
                                                            },
                                                            "dia": {
                                                                "type": "integer"
                                                            },
                                                            "fase": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "dia0",
                                                                    "semana1",
                                                                    "semanas",
                                                                    "mes1",
                                                                    "meses"
                                                                ]
                                                            },
                                                            "fase_rotulo": {
                                                                "type": "string"
                                                            },
                                                            "resumo": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "duracao_segundos": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "tem_video": {
                                                                "type": "boolean"
                                                            },
                                                            "novo": {
                                                                "type": "boolean"
                                                            },
                                                            "disponivel_em": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date"
                                                            },
                                                            "bloqueado": {
                                                                "type": "boolean"
                                                            }
                                                        }
                                                    }
                                                },
                                                "novos": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "disponivel": true,
                                        "cirurgia_data": "2026-10-20",
                                        "dia": 9,
                                        "conteudos": [
                                            {
                                                "id": 4,
                                                "titulo": "Lavar o couro cabeludo nos primeiros dias",
                                                "tipo": "video",
                                                "dia": 3,
                                                "fase": "semana1",
                                                "fase_rotulo": "1.ª semana · dia 3",
                                                "novo": false
                                            }
                                        ],
                                        "proximos": [
                                            {
                                                "id": 6,
                                                "titulo": "Voltar ao exercício",
                                                "dia": 10,
                                                "disponivel_em": "2026-10-30",
                                                "bloqueado": true
                                            }
                                        ],
                                        "novos": 0
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/portal/cuidados/{id}": {
            "get": {
                "tags": [
                    "Portal · Cuidados por fase"
                ],
                "operationId": "portalCuidado",
                "summary": "Open one content item",
                "description": "Sanitised text and video through a signed link (60 min). Only content already available and approved; opening records the view.",
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 4
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "allOf": [
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "titulo": {
                                                            "type": "string"
                                                        },
                                                        "tipo": {
                                                            "type": "string",
                                                            "enum": [
                                                                "video",
                                                                "artigo"
                                                            ]
                                                        },
                                                        "dia": {
                                                            "type": "integer"
                                                        },
                                                        "fase": {
                                                            "type": "string",
                                                            "enum": [
                                                                "dia0",
                                                                "semana1",
                                                                "semanas",
                                                                "mes1",
                                                                "meses"
                                                            ]
                                                        },
                                                        "fase_rotulo": {
                                                            "type": "string"
                                                        },
                                                        "resumo": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "duracao_segundos": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "tem_video": {
                                                            "type": "boolean"
                                                        },
                                                        "novo": {
                                                            "type": "boolean"
                                                        },
                                                        "disponivel_em": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date"
                                                        },
                                                        "bloqueado": {
                                                            "type": "boolean"
                                                        }
                                                    }
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "corpo": {
                                                            "type": "string",
                                                            "description": "Sanitised HTML."
                                                        },
                                                        "video": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "url": {
                                                                    "type": "string",
                                                                    "format": "uri"
                                                                },
                                                                "mime": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/portal/dados": {
            "get": {
                "summary": "My details, preferences and requests",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalDados"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "paciente": {
                                            "numero": "P-2026-00012",
                                            "nome_completo": "Rita Matos",
                                            "data_nascimento": "1988-04-02",
                                            "email": "rita@exemplo.pt",
                                            "telefone": "+351912345678",
                                            "telefone_alt": null,
                                            "morada": "Rua das Flores, 12",
                                            "codigo_postal": "4050-262",
                                            "localidade": "Porto",
                                            "pais": "PT",
                                            "idioma": "pt-PT"
                                        },
                                        "alergias": [],
                                        "preferencias": {
                                            "idioma": "pt-PT",
                                            "canal_preferido": "whatsapp",
                                            "lembretes": true,
                                            "horario": "tarde",
                                            "avisos_email": true,
                                            "marketing": false
                                        },
                                        "pedidos": [
                                            {
                                                "id": 15,
                                                "tipo": "contactos",
                                                "tipo_rotulo": "Atualizar contactos",
                                                "estado": "pendente",
                                                "estado_rotulo": "Recebido",
                                                "criado_em": "2026-10-28T10:02:00+00:00",
                                                "prazo": null,
                                                "decidido_em": null,
                                                "resposta": null,
                                                "mensagem": "Pedido enviado. A equipa vai validá-lo."
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — os meus dados"
                ],
                "operationId": "portalDados",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/dados/alergias": {
            "post": {
                "summary": "Report or remove an allergy",
                "description": "«alergias» request encrypted with the clinical key, validated by whoever can edit the clinical record. «alta» severity creates a high-priority task (portal.departamento_alergias).",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "acao": {
                                        "type": "string",
                                        "enum": [
                                            "acrescentar",
                                            "retirar"
                                        ]
                                    },
                                    "descricao": {
                                        "type": "string",
                                        "minLength": 3,
                                        "maxLength": 500
                                    },
                                    "gravidade": {
                                        "type": "string",
                                        "enum": [
                                            "baixa",
                                            "media",
                                            "alta",
                                            "nao_sei"
                                        ]
                                    },
                                    "alerta_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "acao"
                                ]
                            },
                            "example": {
                                "acao": "acrescentar",
                                "descricao": "Penicilina",
                                "gravidade": "alta"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalPedido"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 15,
                                        "tipo": "alergias",
                                        "tipo_rotulo": "Alergias",
                                        "estado": "pendente",
                                        "estado_rotulo": "Recebido",
                                        "criado_em": "2026-10-28T10:02:00+00:00",
                                        "prazo": null,
                                        "decidido_em": null,
                                        "resposta": null,
                                        "mensagem": "Pedido enviado. A equipa vai validá-lo."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — os meus dados"
                ],
                "operationId": "portalComunicarAlergia",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/dados/contactos": {
            "post": {
                "summary": "Propose a contact update",
                "description": "Creates a «contactos» request to validate (before → after, encrypted). The record only changes when the team accepts it in the portal_pedidos resource. Effects: task for portal.departamento_dados, portal.pedido_criado webhook.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "telefone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "telefone_alt": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "morada": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "codigo_postal": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "pattern": "^\\d{4}-\\d{3}$"
                                    },
                                    "localidade": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "pais": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "telefone": "+351913000111",
                                "morada": "Rua Nova, 5"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalPedido"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 15,
                                        "tipo": "contactos",
                                        "tipo_rotulo": "Atualizar contactos",
                                        "estado": "pendente",
                                        "estado_rotulo": "Recebido",
                                        "criado_em": "2026-10-28T10:02:00+00:00",
                                        "prazo": null,
                                        "decidido_em": null,
                                        "resposta": null,
                                        "mensagem": "Pedido enviado. A equipa vai validá-lo."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — os meus dados"
                ],
                "operationId": "portalProporContactos",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/dados/eliminar-conta": {
            "post": {
                "summary": "Request account deletion",
                "description": "confirmar = true. The account becomes «eliminacao_pedida», all sessions and tokens end, a confirmation email is sent and an «eliminar_conta» request (legal deadline) goes to administration. The clinical record and invoicing are kept for the legal periods.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "confirmar": {
                                        "const": true
                                    },
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000
                                    }
                                },
                                "required": [
                                    "confirmar"
                                ]
                            },
                            "example": {
                                "confirmar": true,
                                "motivo": null
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "sessao_terminada": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "mensagem": "Pedido registado. A sua sessão terminou.",
                                        "sessao_terminada": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — os meus dados"
                ],
                "operationId": "portalEliminarConta",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/dados/exportar": {
            "get": {
                "summary": "Portability: export my data",
                "description": "Structured JSON (anagensys.portabilidade.v1 format): data subject, allergies, preferences, account, consents, appointments, documents, payments, invoices, messages and requests. «exportar» audit and portability request completed.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "formato": {
                                                    "const": "anagensys.portabilidade.v1"
                                                },
                                                "gerado_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "titular": {
                                                    "type": "object"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "formato": "anagensys.portabilidade.v1",
                                        "gerado_em": "2026-10-28T10:50:00+00:00",
                                        "titular": {
                                            "nome_completo": "Rita Matos"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — os meus dados"
                ],
                "operationId": "portalExportar",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/dados/palavra-passe": {
            "post": {
                "summary": "Set or change the password",
                "description": "Requires the current one when set; core password policy. Increases the session version and revokes all tokens (the app signs in again).",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "atual": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "nova": {
                                        "type": "string",
                                        "minLength": 10,
                                        "maxLength": 200
                                    }
                                },
                                "required": [
                                    "nova"
                                ]
                            },
                            "example": {
                                "atual": "••••••••••",
                                "nova": "••••••••••••"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "sessao_terminada": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "mensagem": "Palavra-passe guardada. As outras sessões terminaram.",
                                        "sessao_terminada": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — os meus dados"
                ],
                "operationId": "portalPalavraPasse",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/dados/pedidos": {
            "post": {
                "summary": "Exercise a data subject right",
                "description": "Access, rectification, erasure, objection or restriction (portability: use GET /portal/dados/exportar). Legal deadline of 30 days; forwarded to pedidos_titulares (M2) when present; high-priority task for portal.departamento_rgpd. One open request per type (409).",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "acesso",
                                            "retificacao",
                                            "portabilidade",
                                            "apagamento",
                                            "oposicao",
                                            "limitacao"
                                        ]
                                    },
                                    "descricao": {
                                        "type": "string",
                                        "maxLength": 2000
                                    }
                                },
                                "required": [
                                    "tipo"
                                ]
                            },
                            "example": {
                                "tipo": "acesso",
                                "descricao": "Pedido de cópia do processo clínico."
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalPedido"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 16,
                                        "tipo": "acesso",
                                        "estado": "pendente",
                                        "prazo": "2026-11-27",
                                        "mensagem": "Pedido registado. Resposta até 27/11/2026."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — os meus dados"
                ],
                "operationId": "portalPedidoDireito",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/dados/preferencias": {
            "put": {
                "summary": "Communication and language preferences",
                "description": "Immediate effect (portal_contas.preferencias and pacientes.idioma). marketing records a «given» consent or the revocation.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    },
                                    "canal_preferido": {
                                        "type": "string",
                                        "enum": [
                                            "email",
                                            "sms",
                                            "whatsapp",
                                            "telefone"
                                        ]
                                    },
                                    "horario": {
                                        "type": "string",
                                        "enum": [
                                            "manha",
                                            "tarde",
                                            "qualquer"
                                        ]
                                    },
                                    "lembretes": {
                                        "type": "boolean"
                                    },
                                    "avisos_email": {
                                        "type": "boolean"
                                    },
                                    "marketing": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "idioma": "en",
                                "canal_preferido": "email",
                                "lembretes": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalDados"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "preferencias": {
                                            "idioma": "en",
                                            "canal_preferido": "email",
                                            "lembretes": true,
                                            "horario": "qualquer",
                                            "avisos_email": true,
                                            "marketing": false
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — os meus dados"
                ],
                "operationId": "portalPreferencias",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/documentos": {
            "get": {
                "summary": "Documents, forms and uploads",
                "description": "Shared documents (documentos.partilhado_paciente and files shared by the team), to sign, uploaded by the patient and requested forms (to fill in).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "partilhados": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalDocumento"
                                                    }
                                                },
                                                "por_assinar": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalDocumento"
                                                    }
                                                },
                                                "enviados": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "formularios": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "pode_enviar": {
                                                    "type": "boolean"
                                                },
                                                "tipos_envio": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "max_mb": {
                                                    "type": "integer",
                                                    "x-unidade": "MB"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "partilhados": [],
                                        "por_assinar": [
                                            {
                                                "id": 305,
                                                "ficheiro_id": 9921,
                                                "origem": "documento",
                                                "titulo": "Instruções pré-operatórias",
                                                "tipo": "instrucoes",
                                                "tipo_rotulo": "Instruções",
                                                "estado": "enviado",
                                                "estado_rotulo": "Por assinar",
                                                "data": "2026-10-27T11:00:00+00:00",
                                                "assinado_em": null,
                                                "codigo_verificacao": "7KQ2-9XHM",
                                                "pode_assinar": true,
                                                "lido_em": null,
                                                "url": "https://anagen.pt/f/eyJmIjo5OTIx….a1b",
                                                "url_descarregar": "https://anagen.pt/f/eyJmIjo5OTIx….c2d"
                                            }
                                        ],
                                        "enviados": [],
                                        "formularios": [
                                            {
                                                "id": 51,
                                                "nome": "Questionário pré-operatório",
                                                "tipo": "questionario_previo",
                                                "pedido_em": "2026-10-26T09:00:00+00:00",
                                                "expira_em": "2026-11-02T23:59:00+00:00"
                                            }
                                        ],
                                        "pode_enviar": true,
                                        "tipos_envio": [
                                            {
                                                "valor": "exame",
                                                "rotulo": "Exame"
                                            }
                                        ],
                                        "max_mb": 25
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — documentos"
                ],
                "operationId": "portalDocumentos",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            },
            "post": {
                "summary": "Upload a document",
                "description": "PDF, image or document; real type checked by content, executable extensions refused, random name, stored encrypted outside the public root (core Files). Effects: task for portal.departamento_documentos, timeline, portal.documento_enviado webhook.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "titulo": {
                                        "type": "string",
                                        "maxLength": 160
                                    },
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "exame",
                                            "analises",
                                            "relatorio",
                                            "receita",
                                            "identificacao",
                                            "outro"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 10101,
                                        "titulo": "Análises",
                                        "tipo": "analises",
                                        "tipo_rotulo": "Análises",
                                        "nome": "analises.pdf",
                                        "tipo_logico": "pdf",
                                        "tamanho": 183224,
                                        "data": "2026-10-28T10:30:00+00:00",
                                        "url": "https://anagen.pt/f/…"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — documentos"
                ],
                "operationId": "portalEnviarDocumento",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/documentos/{id}": {
            "get": {
                "summary": "Shared document",
                "description": "With signed links (view and download, 15 min); the first opening is recorded.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalDocumento"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 305,
                                        "ficheiro_id": 9921,
                                        "origem": "documento",
                                        "titulo": "Instruções pré-operatórias",
                                        "tipo": "instrucoes",
                                        "tipo_rotulo": "Instruções",
                                        "estado": "enviado",
                                        "estado_rotulo": "Por assinar",
                                        "data": "2026-10-27T11:00:00+00:00",
                                        "assinado_em": null,
                                        "codigo_verificacao": "7KQ2-9XHM",
                                        "pode_assinar": true,
                                        "lido_em": null,
                                        "url": "https://anagen.pt/f/eyJmIjo5OTIx….a1b",
                                        "url_descarregar": "https://anagen.pt/f/eyJmIjo5OTIx….c2d"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — documentos"
                ],
                "operationId": "portalDocumento",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/documentos/{id}/assinar": {
            "post": {
                "summary": "Sign a document on screen",
                "description": "Only «sent» documents awaiting signature. Stores the signature (PNG) and sets «signed» (assinatura_tipo «ecra»). Effects: notice to the issuer, timeline, «assinar» audit.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "aceito": {
                                        "type": "boolean"
                                    },
                                    "assinatura": {
                                        "type": "string",
                                        "contentEncoding": "base64",
                                        "contentMediaType": "image/png"
                                    }
                                },
                                "required": [
                                    "aceito",
                                    "assinatura"
                                ]
                            },
                            "example": {
                                "aceito": true,
                                "assinatura": "data:image/png;base64,iVBORw0KGgo…"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalDocumento"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 305,
                                        "ficheiro_id": 9921,
                                        "origem": "documento",
                                        "titulo": "Instruções pré-operatórias",
                                        "tipo": "instrucoes",
                                        "tipo_rotulo": "Instruções",
                                        "estado": "assinado",
                                        "estado_rotulo": "Assinado",
                                        "data": "2026-10-27T11:00:00+00:00",
                                        "assinado_em": "2026-10-28T10:40:00+00:00",
                                        "codigo_verificacao": "7KQ2-9XHM",
                                        "pode_assinar": false,
                                        "lido_em": null,
                                        "url": "https://anagen.pt/f/eyJmIjo5OTIx….a1b",
                                        "url_descarregar": "https://anagen.pt/f/eyJmIjo5OTIx….c2d"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — documentos"
                ],
                "operationId": "portalAssinarDocumento",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/ficha/restricoes": {
            "get": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1PortalRestricoes",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente",
                "summary": "Portal: per-section access restrictions on my record",
                "description": "Patient tokens only (portal). The sections the patient can restrict (consultations, photos, plan, surgeries, follow-up, documents, consents, communications, bookings and financial, those installed) and the status of each. Clinical alerts, identification, episodes and the timeline are never restricted. Follows the portal «acessos» feature.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "seccoes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "chave": {
                                                                "type": "string"
                                                            },
                                                            "titulo": {
                                                                "type": "string"
                                                            },
                                                            "icone": {
                                                                "type": "string"
                                                            },
                                                            "descricao": {
                                                                "type": "string"
                                                            },
                                                            "restrita": {
                                                                "type": "boolean"
                                                            },
                                                            "desde": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        }
                                                    }
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "seccoes": [
                                            {
                                                "chave": "fotografias",
                                                "titulo": "Fotografias",
                                                "icone": "camera",
                                                "descricao": "Fotografias clínicas e capturas.",
                                                "restrita": true,
                                                "desde": "2026-10-29T09:00:00+00:00"
                                            }
                                        ],
                                        "total": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1PortalDefinirRestricao",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente",
                "summary": "Portal: restrict a section or lift the restriction",
                "description": "With the restriction active, the section stays listed in the record (marked «restrita», without a counter) but only opens with emergency access, which is audited with «quebrar_vidro» and appears in «Who accessed my data»; the FHIR summary leaves it out. Section outside the list → 422 on «seccao». Effects: immutable history row, «alterar» audit and timeline entry (administrative). Returns the same shape as the GET.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "seccao": {
                                        "type": "string"
                                    },
                                    "restringir": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "seccao",
                                    "restringir"
                                ]
                            },
                            "example": {
                                "seccao": "fotografias",
                                "restringir": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "seccoes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/portal/ficha/resumo-fhir": {
            "get": {
                "tags": [
                    "Ficha do paciente"
                ],
                "operationId": "m1PortalResumoFhir",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente",
                "summary": "Portal: my summary in HL7 FHIR R4 (IPS)",
                "description": "The same Bundle as GET /pacientes/{id}/resumo-fhir, of the own record (restrictions do not apply to oneself). envelope=1 → common envelope with meta.ficheiro. Effects: «exportar» audit.",
                "parameters": [
                    {
                        "name": "envelope",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        },
                        "description": "1 → in the common envelope"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "FHIR R4 Bundle (IPS)",
                        "content": {
                            "application/fhir+json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/portal/formularios/{id}": {
            "get": {
                "summary": "Form requested from the patient",
                "description": "Normalised schema (sections and fields) of the M1 form still to fill in and within the deadline.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Requested response"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalFormulario"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 51,
                                        "nome": "Questionário pré-operatório",
                                        "tipo": "questionario_previo",
                                        "expira_em": "2026-11-02T23:59:00+00:00",
                                        "seccoes": [
                                            {
                                                "titulo": "Medicação",
                                                "campos": [
                                                    {
                                                        "chave": "anticoagulantes",
                                                        "tipo": "booleano",
                                                        "rotulo": "Toma anticoagulantes?",
                                                        "ajuda": null,
                                                        "obrigatorio": true,
                                                        "opcoes": [
                                                            {
                                                                "valor": "1",
                                                                "rotulo": "Sim"
                                                            },
                                                            {
                                                                "valor": "0",
                                                                "rotulo": "Não"
                                                            }
                                                        ]
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — documentos"
                ],
                "operationId": "portalFormulario",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            },
            "post": {
                "summary": "Answer a form",
                "description": "Through the M1 form engine (Clinica\\Formularios::submeter): validation against the request version (questions, conditions, types), «tratamento_clinico» consent — and «fotografias_clinicas» with photos — already given or declared in «consentimentos» (otherwise per-field 422 «consentimentos.<finalidade>»), only photos uploaded for this request, encrypted answers, score, alarms, alerts awaiting validation and formulario.respondido webhook; status «por_validar». The GET also returns, as compatible additions, «esquema» (request version), «valores», «consentimentos» and «devolucao_motivo». Effects: notice to the episode doctor, timeline, audit.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Requested response"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "respostas": {
                                        "type": "object",
                                        "additionalProperties": true
                                    },
                                    "consentimentos": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "boolean"
                                        }
                                    }
                                },
                                "required": [
                                    "respostas"
                                ]
                            },
                            "example": {
                                "respostas": {
                                    "anticoagulantes": "nao"
                                },
                                "consentimentos": {
                                    "tratamento_clinico": true
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "estado": {
                                                    "type": "string"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 51,
                                        "estado": "por_validar",
                                        "mensagem": "Respostas enviadas. A equipa vai revê-las."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — documentos"
                ],
                "operationId": "portalResponderFormulario",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/formularios/{id}/ficheiros": {
            "post": {
                "summary": "Photo for a form question",
                "description": "Multipart «ficheiro» (images only, 15 MB, real type from the bytes, encrypted, tied to this request) and «consentimento_fotos» = 1 when the photo authorisation was ticked now; without it (and no consent already given) 422 on «ficheiro». Returns the identifier to use in the answer.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Requested response"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "nome": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 9051,
                                        "nome": "frontal.jpg"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — documentos"
                ],
                "operationId": "portalFicheiroFormulario",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/fotos": {
            "get": {
                "summary": "Protocol, requests and photos",
                "description": "«portal» protocol views (or the six default views) with instructions and outline, requests per milestone, photos sent and shared by the doctor (never simulations), and the quality limits.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "protocolo": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "nome": {
                                                            "type": "string"
                                                        },
                                                        "vistas": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "chave": {
                                                                        "type": "string"
                                                                    },
                                                                    "nome": {
                                                                        "type": "string"
                                                                    },
                                                                    "instrucoes": {
                                                                        "type": "string"
                                                                    },
                                                                    "silhueta": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                            "frontal",
                                                                            "topo",
                                                                            "coroa",
                                                                            "lateral_esq",
                                                                            "lateral_dir",
                                                                            "dadora"
                                                                        ]
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                "pedidos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "enviadas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalFoto"
                                                    }
                                                },
                                                "partilhadas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalFoto"
                                                    }
                                                },
                                                "qualidade": {
                                                    "type": "object",
                                                    "properties": {
                                                        "luz_min": {
                                                            "type": "integer"
                                                        },
                                                        "luz_max": {
                                                            "type": "integer"
                                                        },
                                                        "nitidez_min": {
                                                            "type": "number"
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "protocolo": {
                                            "id": null,
                                            "nome": "Fotografias de acompanhamento",
                                            "vistas": [
                                                {
                                                    "chave": "frontal",
                                                    "nome": "Frente",
                                                    "instrucoes": "Olhe em frente…",
                                                    "silhueta": "frontal"
                                                }
                                            ]
                                        },
                                        "pedidos": [
                                            {
                                                "id": 66,
                                                "marco": "m1",
                                                "marco_rotulo": "1 mês",
                                                "data_prevista": "2026-11-20",
                                                "estado": "pendente",
                                                "atrasado": false
                                            }
                                        ],
                                        "enviadas": [
                                            {
                                                "id": 5021,
                                                "ficheiro_id": 10044,
                                                "vista": "frontal",
                                                "vista_rotulo": "Frente",
                                                "estado": "por_verificar",
                                                "estado_rotulo": "Em revisão",
                                                "data": "2026-10-28T09:12:00+00:00",
                                                "url": "https://anagen.pt/f/eyJmIjoxMDA0NC….9z"
                                            }
                                        ],
                                        "partilhadas": [],
                                        "qualidade": {
                                            "luz_min": 60,
                                            "luz_max": 225,
                                            "nitidez_min": 18
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — fotografias"
                ],
                "operationId": "portalFotos",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            },
            "post": {
                "summary": "Send a photo for a view",
                "description": "Light (mean 0–255) and focus (Laplacian standard deviation) checked on the server with the Settings limits; outside → 422, unless forcar = 1. Encrypted clinical file without EXIF/GPS; row in «fotos» (origin portal, to check) and milestone set to «fotos_enviadas». Effects: one notice per day to portal.departamento_fotos, timeline, portal.fotos_enviadas webhook.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro",
                                    "vista"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "vista": {
                                        "type": "string"
                                    },
                                    "marco_id": {
                                        "type": "integer"
                                    },
                                    "forcar": {
                                        "type": "integer",
                                        "enum": [
                                            0,
                                            1
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalFoto"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 5021,
                                        "ficheiro_id": 10044,
                                        "vista": "frontal",
                                        "vista_rotulo": "Frente",
                                        "estado": "por_verificar",
                                        "estado_rotulo": "Em revisão",
                                        "data": "2026-10-28T09:12:00+00:00",
                                        "url": "https://anagen.pt/f/eyJmIjoxMDA0NC….9z",
                                        "luz": 132.4,
                                        "nitidez": 41.2
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — fotografias"
                ],
                "operationId": "portalEnviarFoto",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/inicio": {
            "get": {
                "summary": "Portal home summary",
                "description": "Next appointment, recovery stage and progress, counters (messages, documents, permissions, photos, notifications), balance, journey and latest updates. Each block is empty (null) when the feature is switched off by the clinic or the module does not exist yet.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "paciente": {
                                                    "type": "object"
                                                },
                                                "clinica": {
                                                    "type": "object"
                                                },
                                                "boas_vindas": {
                                                    "type": "string"
                                                },
                                                "jornada": {
                                                    "type": "object",
                                                    "properties": {
                                                        "etapa": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 9
                                                        },
                                                        "episodio_id": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "titulo": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    }
                                                },
                                                "proxima_marcacao": {
                                                    "oneOf": [
                                                        {
                                                            "$ref": "#/components/schemas/PortalMarcacao"
                                                        },
                                                        {
                                                            "type": "null"
                                                        }
                                                    ]
                                                },
                                                "recuperacao": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ]
                                                },
                                                "contadores": {
                                                    "type": "object",
                                                    "properties": {
                                                        "mensagens": {
                                                            "type": "integer"
                                                        },
                                                        "documentos": {
                                                            "type": "integer"
                                                        },
                                                        "consentimentos": {
                                                            "type": "integer"
                                                        },
                                                        "fotos": {
                                                            "type": "integer"
                                                        },
                                                        "notificacoes": {
                                                            "type": "integer"
                                                        }
                                                    }
                                                },
                                                "saldo": {
                                                    "$ref": "#/components/schemas/PortalSaldo"
                                                },
                                                "novidades": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalNovidade"
                                                    }
                                                },
                                                "funcionalidades": {
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "boolean"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "paciente": {
                                            "primeiro_nome": "Rita",
                                            "nome_completo": "Rita Matos",
                                            "numero": "P-2026-00012"
                                        },
                                        "proxima_marcacao": {
                                            "id": 812,
                                            "inicio": "2026-11-04T10:30:00+00:00",
                                            "fim": "2026-11-04T11:00:00+00:00",
                                            "estado": "marcada",
                                            "estado_rotulo": "Marcada",
                                            "tom": "info",
                                            "tipo": {
                                                "id": 3,
                                                "nome": "Consulta de controlo",
                                                "teleconsulta": false,
                                                "cor": "#2D5C8A"
                                            },
                                            "profissional": "Dr.ª Inês Valente",
                                            "profissional_id": 7,
                                            "origem": "portal",
                                            "pode_confirmar": true,
                                            "pode_alterar": true,
                                            "pode_cancelar": true,
                                            "limite_alteracao": "2026-11-03T10:30:00+00:00",
                                            "politica": "Cancelamentos até 24 h antes.",
                                            "antecedencia_h": 24,
                                            "teleconsulta": null
                                        },
                                        "contadores": {
                                            "mensagens": 1,
                                            "documentos": 2,
                                            "consentimentos": 1,
                                            "fotos": 0,
                                            "notificacoes": 3
                                        },
                                        "jornada": {
                                            "etapa": 5,
                                            "episodio_id": 19,
                                            "titulo": "FUE couro cabeludo"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — início"
                ],
                "operationId": "portalInicio",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/marcacoes": {
            "get": {
                "summary": "Patient appointments",
                "description": "Upcoming (ascending) and past (descending), with the actions allowed by the policy (pode_confirmar, pode_alterar, pode_cancelar, limite_alteracao) and the video consultation status.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "disponivel": {
                                                    "type": "boolean"
                                                },
                                                "proximas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalMarcacao"
                                                    }
                                                },
                                                "passadas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalMarcacao"
                                                    }
                                                },
                                                "pode_marcar": {
                                                    "type": "boolean"
                                                },
                                                "politica": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "disponivel": true,
                                        "proximas": [
                                            {
                                                "id": 812,
                                                "inicio": "2026-11-04T10:30:00+00:00",
                                                "fim": "2026-11-04T11:00:00+00:00",
                                                "estado": "marcada",
                                                "estado_rotulo": "Marcada",
                                                "tom": "info",
                                                "tipo": {
                                                    "id": 3,
                                                    "nome": "Consulta de controlo",
                                                    "teleconsulta": false,
                                                    "cor": "#2D5C8A"
                                                },
                                                "profissional": "Dr.ª Inês Valente",
                                                "profissional_id": 7,
                                                "origem": "portal",
                                                "pode_confirmar": true,
                                                "pode_alterar": true,
                                                "pode_cancelar": true,
                                                "limite_alteracao": "2026-11-03T10:30:00+00:00",
                                                "politica": "Cancelamentos até 24 h antes.",
                                                "antecedencia_h": 24,
                                                "teleconsulta": null
                                            }
                                        ],
                                        "passadas": [],
                                        "pode_marcar": true,
                                        "politica": ""
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — marcações"
                ],
                "operationId": "portalMarcacoes",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            },
            "post": {
                "summary": "Book a free slot",
                "description": "The time must be one of the slots returned by GET /portal/marcacoes/vagas (checked again on the server). Created by Agenda\\Marcacoes::criar (conflicts, schedules, margins) with origin «portal». Effects: reception notice, timeline, audit; M6 fires marcacao.criada.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tipo_id": {
                                        "type": "integer"
                                    },
                                    "inicio": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "profissional_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 500
                                    }
                                },
                                "required": [
                                    "tipo_id",
                                    "inicio"
                                ]
                            },
                            "example": {
                                "tipo_id": 3,
                                "inicio": "2026-11-04T10:30:00+00:00",
                                "profissional_id": 7,
                                "notas": null
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalMarcacao"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 812,
                                        "inicio": "2026-11-04T10:30:00+00:00",
                                        "fim": "2026-11-04T11:00:00+00:00",
                                        "estado": "marcada",
                                        "estado_rotulo": "Marcada",
                                        "tom": "info",
                                        "tipo": {
                                            "id": 3,
                                            "nome": "Consulta de controlo",
                                            "teleconsulta": false,
                                            "cor": "#2D5C8A"
                                        },
                                        "profissional": "Dr.ª Inês Valente",
                                        "profissional_id": 7,
                                        "origem": "portal",
                                        "pode_confirmar": true,
                                        "pode_alterar": true,
                                        "pode_cancelar": true,
                                        "limite_alteracao": "2026-11-03T10:30:00+00:00",
                                        "politica": "Cancelamentos até 24 h antes.",
                                        "antecedencia_h": 24,
                                        "teleconsulta": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — marcações"
                ],
                "operationId": "portalMarcar",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/marcacoes/tipos": {
            "get": {
                "summary": "Types bookable online",
                "description": "Active types with «online» on (never surgeries); video consultations only if the feature is on.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/PortalTipoMarcacao"
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 3,
                                            "nome": "Consulta de controlo",
                                            "duracao_min": 30,
                                            "teleconsulta": false,
                                            "exige_sinal": false,
                                            "valor_sinal": null,
                                            "politica_cancelamento": null,
                                            "antecedencia_h": 24,
                                            "cor": "#2D5C8A"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — marcações"
                ],
                "operationId": "portalTiposMarcacao",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/marcacoes/vagas": {
            "get": {
                "summary": "Free slots for a type",
                "description": "Slots between two dates (max 45 days, never in the past, with the minimum notice portal.marcar_antecedencia_horas). Source: Agenda\\Marcacoes::disponibilidade.",
                "parameters": [
                    {
                        "name": "tipo_id",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "de",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "profissional_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/PortalVaga"
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "inicio": "2026-11-04T10:30:00+00:00",
                                            "fim": "2026-11-04T11:00:00+00:00",
                                            "profissional_id": 7,
                                            "profissional": "Dr.ª Inês Valente"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — marcações"
                ],
                "operationId": "portalVagas",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/marcacoes/{id}": {
            "get": {
                "summary": "Appointment detail",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalMarcacao"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 812,
                                        "inicio": "2026-11-04T10:30:00+00:00",
                                        "fim": "2026-11-04T11:00:00+00:00",
                                        "estado": "marcada",
                                        "estado_rotulo": "Marcada",
                                        "tom": "info",
                                        "tipo": {
                                            "id": 3,
                                            "nome": "Consulta de controlo",
                                            "teleconsulta": false,
                                            "cor": "#2D5C8A"
                                        },
                                        "profissional": "Dr.ª Inês Valente",
                                        "profissional_id": 7,
                                        "origem": "portal",
                                        "pode_confirmar": true,
                                        "pode_alterar": true,
                                        "pode_cancelar": true,
                                        "limite_alteracao": "2026-11-03T10:30:00+00:00",
                                        "politica": "Cancelamentos até 24 h antes.",
                                        "antecedencia_h": 24,
                                        "teleconsulta": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — marcações"
                ],
                "operationId": "portalMarcacao",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/marcacoes/{id}/cancelar": {
            "post": {
                "summary": "Cancel within the policy",
                "description": "Until limite_alteracao (type notice or portal.alterar_antecedencia_horas). After that: 409 «fora_da_politica». Effects: reception notice, timeline, audit.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 300
                                    }
                                }
                            },
                            "example": {
                                "motivo": "Viagem de trabalho"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalMarcacao"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 812,
                                        "inicio": "2026-11-04T10:30:00+00:00",
                                        "fim": "2026-11-04T11:00:00+00:00",
                                        "estado": "cancelada",
                                        "estado_rotulo": "Cancelada",
                                        "tom": "info",
                                        "tipo": {
                                            "id": 3,
                                            "nome": "Consulta de controlo",
                                            "teleconsulta": false,
                                            "cor": "#2D5C8A"
                                        },
                                        "profissional": "Dr.ª Inês Valente",
                                        "profissional_id": 7,
                                        "origem": "portal",
                                        "pode_confirmar": false,
                                        "pode_alterar": false,
                                        "pode_cancelar": false,
                                        "limite_alteracao": "2026-11-03T10:30:00+00:00",
                                        "politica": "Cancelamentos até 24 h antes.",
                                        "antecedencia_h": 24,
                                        "teleconsulta": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — marcações"
                ],
                "operationId": "portalCancelarMarcacao",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/marcacoes/{id}/confirmar": {
            "post": {
                "summary": "Confirm attendance",
                "description": "Only future «booked» appointments → «confirmed» (confirmada_em, portal channel).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalMarcacao"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 812,
                                        "inicio": "2026-11-04T10:30:00+00:00",
                                        "fim": "2026-11-04T11:00:00+00:00",
                                        "estado": "confirmada",
                                        "estado_rotulo": "Confirmada",
                                        "tom": "info",
                                        "tipo": {
                                            "id": 3,
                                            "nome": "Consulta de controlo",
                                            "teleconsulta": false,
                                            "cor": "#2D5C8A"
                                        },
                                        "profissional": "Dr.ª Inês Valente",
                                        "profissional_id": 7,
                                        "origem": "portal",
                                        "pode_confirmar": false,
                                        "pode_alterar": true,
                                        "pode_cancelar": true,
                                        "limite_alteracao": "2026-11-03T10:30:00+00:00",
                                        "politica": "Cancelamentos até 24 h antes.",
                                        "antecedencia_h": 24,
                                        "teleconsulta": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — marcações"
                ],
                "operationId": "portalConfirmarMarcacao",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/marcacoes/{id}/remarcar": {
            "post": {
                "summary": "Reschedule to another slot",
                "description": "Creates the new appointment (same rules as POST /portal/marcacoes) with remarcada_de and closes the previous one as «rescheduled». Returns the new appointment.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "inicio": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "profissional_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "inicio"
                                ]
                            },
                            "example": {
                                "inicio": "2026-11-06T15:00:00+00:00",
                                "profissional_id": 7
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalMarcacao"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 815,
                                        "inicio": "2026-11-06T15:00:00+00:00",
                                        "fim": "2026-11-04T11:00:00+00:00",
                                        "estado": "marcada",
                                        "estado_rotulo": "Marcada",
                                        "tom": "info",
                                        "tipo": {
                                            "id": 3,
                                            "nome": "Consulta de controlo",
                                            "teleconsulta": false,
                                            "cor": "#2D5C8A"
                                        },
                                        "profissional": "Dr.ª Inês Valente",
                                        "profissional_id": 7,
                                        "origem": "portal",
                                        "pode_confirmar": true,
                                        "pode_alterar": true,
                                        "pode_cancelar": true,
                                        "limite_alteracao": "2026-11-03T10:30:00+00:00",
                                        "politica": "Cancelamentos até 24 h antes.",
                                        "antecedencia_h": 24,
                                        "teleconsulta": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — marcações"
                ],
                "operationId": "portalRemarcar",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/marcacoes/{id}/teleconsulta": {
            "post": {
                "summary": "Enter the video consultation waiting room",
                "description": "The room opens portal.teleconsulta_minutos_antes before the time. Sets the consultation to «sala_espera», notifies the doctor and returns the room https address (M6 video provider). 409 «sala_por_preparar» if the room does not exist yet.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "url": {
                                                    "type": "string"
                                                },
                                                "estado": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "url": "https://video.anagen.pt/sala/8f2c1e",
                                        "estado": "sala_espera"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — marcações"
                ],
                "operationId": "portalEntrarTeleconsulta",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/mensagens": {
            "get": {
                "summary": "Conversation with the team",
                "description": "«portal» channel messages (incoming and outgoing — never internal notes), oldest first; with ?desde=<id> only new ones. Opening marks team messages as read. Includes the stated reply time.",
                "parameters": [
                    {
                        "name": "desde",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "disponivel": {
                                                    "type": "boolean"
                                                },
                                                "mensagens": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalMensagem"
                                                    }
                                                },
                                                "resposta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "horas": {
                                                            "type": "integer",
                                                            "x-unidade": "h"
                                                        },
                                                        "horario": {
                                                            "type": "string"
                                                        },
                                                        "urgencia": {
                                                            "type": "string"
                                                        }
                                                    }
                                                },
                                                "clinica": {
                                                    "type": "object"
                                                },
                                                "ultimo_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "disponivel": true,
                                        "mensagens": [
                                            {
                                                "id": 731,
                                                "minha": false,
                                                "autor": "Enf.ª Sofia Lima",
                                                "corpo": "Bom dia! As crostas caem normalmente até ao 10.º dia.",
                                                "anexos": [],
                                                "estado": "lida",
                                                "criado_em": "2026-10-28T09:40:00+00:00"
                                            }
                                        ],
                                        "resposta": {
                                            "horas": 24,
                                            "horario": "dias úteis, 9h–19h",
                                            "urgencia": "Em caso de urgência…"
                                        },
                                        "ultimo_id": 731
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — mensagens"
                ],
                "operationId": "portalMensagens",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            },
            "post": {
                "summary": "Send a message",
                "description": "Body 2–4000 characters; up to 5 attachments uploaded first to /portal/mensagens/anexos. Entered through Crm\\Conversas::registarEntrada (triage, SLA, assignment); without it, stored in the conversation and reception is notified. urgente = true creates an urgent task (portal.departamento_urgencias).",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "corpo": {
                                        "type": "string",
                                        "minLength": 2,
                                        "maxLength": 4000
                                    },
                                    "anexos": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    },
                                    "urgente": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "corpo"
                                ]
                            },
                            "example": {
                                "corpo": "Bom dia, posso lavar a cabeça amanhã?",
                                "anexos": [],
                                "urgente": false
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "disponivel": true,
                                        "mensagens": [
                                            {
                                                "id": 731,
                                                "minha": false,
                                                "autor": "Enf.ª Sofia Lima",
                                                "corpo": "Bom dia! As crostas caem normalmente até ao 10.º dia.",
                                                "anexos": [],
                                                "estado": "lida",
                                                "criado_em": "2026-10-28T09:40:00+00:00"
                                            }
                                        ],
                                        "ultimo_id": 732
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — mensagens"
                ],
                "operationId": "portalEnviarMensagem",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/mensagens/anexos": {
            "post": {
                "summary": "Upload an attachment",
                "description": "Image, PDF or document up to 15 MB, encrypted; returns the id to use in «anexos».",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "nome": {
                                                    "type": "string"
                                                },
                                                "tipo": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 10220,
                                        "nome": "penso.jpg",
                                        "tipo": "imagem"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — mensagens"
                ],
                "operationId": "portalAnexoMensagem",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/novidades": {
            "get": {
                "summary": "Patient updates (notifications)",
                "description": "Patient notifications, newest first, with links for web and app. No clinical content. meta.por_ler and meta.contadores for menu badges.",
                "parameters": [
                    {
                        "name": "pagina",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "por_pagina",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 100
                        }
                    },
                    {
                        "name": "por_ler",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/PortalNovidade"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "pagina": {
                                                    "type": "integer"
                                                },
                                                "por_pagina": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "por_ler": {
                                                    "type": "integer"
                                                },
                                                "contadores": {
                                                    "type": "object"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 3311,
                                            "tipo": "mensagem_portal",
                                            "titulo": "Tem uma mensagem nova da clínica",
                                            "corpo": "",
                                            "ligacao": {
                                                "web": "portal/mensagens",
                                                "app": "/e/portal_mensagens"
                                            },
                                            "lida_em": null,
                                            "criado_em": "2026-10-28T09:40:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — início"
                ],
                "operationId": "portalNovidades",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/pagamentos": {
            "get": {
                "summary": "Balance, payments and invoices",
                "description": "Balance (accepted proposals − payments received), payments (with Multibanco reference when present) and issued invoices with the PDF. Available methods: those in portal.pagamentos_metodos with the payment service active.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "saldo": {
                                                    "$ref": "#/components/schemas/PortalSaldo"
                                                },
                                                "pagamentos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalPagamento"
                                                    }
                                                },
                                                "faturas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalFatura"
                                                    }
                                                },
                                                "metodos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "enum": [
                                                            "mbway",
                                                            "multibanco",
                                                            "ligacao"
                                                        ]
                                                    }
                                                },
                                                "pode_pagar": {
                                                    "type": "boolean"
                                                },
                                                "aviso": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "saldo": {
                                            "total_aceite": 4980,
                                            "pago": 0,
                                            "em_divida": 4980,
                                            "pendente": 500,
                                            "pendentes": 1,
                                            "moeda": "EUR",
                                            "pct_pago": 0
                                        },
                                        "pagamentos": [
                                            {
                                                "id": 204,
                                                "tipo": "sinal",
                                                "tipo_rotulo": "Sinal",
                                                "valor": 500,
                                                "moeda": "EUR",
                                                "metodo": "multibanco",
                                                "metodo_rotulo": "Referência Multibanco",
                                                "estado": "pendente",
                                                "estado_rotulo": "Por pagar",
                                                "tom": "aviso",
                                                "mb_entidade": "21423",
                                                "mb_referencia": "123456789",
                                                "mb_validade": "2026-11-05T23:59:00+00:00",
                                                "telefone": null,
                                                "vence_em": "2026-11-05",
                                                "pago_em": null,
                                                "pode_pagar": true,
                                                "fatura": null
                                            }
                                        ],
                                        "faturas": [
                                            {
                                                "id": 88,
                                                "tipo": "FR",
                                                "numero": "FR A/2026/88",
                                                "atcud": "JJ37MMBR-88",
                                                "total": 80,
                                                "iva": 0,
                                                "descricao": "Consulta de avaliação",
                                                "emitido_em": "2026-10-02T15:20:00+00:00",
                                                "url": "https://anagen.pt/f/eyJmIjo4ODAx….q"
                                            }
                                        ],
                                        "metodos": [
                                            "mbway",
                                            "multibanco"
                                        ],
                                        "pode_pagar": true,
                                        "aviso": ""
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — pagamentos"
                ],
                "operationId": "portalPagamentos",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            },
            "post": {
                "summary": "Pay (MB WAY, Multibanco or link)",
                "description": "A pending payment (pagamento_id) or a free amount up to the balance due (valor). MB WAY requires a Portuguese mobile (9 digits). A still-valid Multibanco reference is returned without creating another. Comercial\\Pagamentos::criar (M5) creates the reference/request/link; the portal never receives card data.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "pagamento_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "valor": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "x-unidade": "EUR"
                                    },
                                    "metodo": {
                                        "type": "string",
                                        "enum": [
                                            "mbway",
                                            "multibanco",
                                            "ligacao"
                                        ]
                                    },
                                    "telefone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "metodo"
                                ]
                            },
                            "example": {
                                "pagamento_id": 204,
                                "metodo": "mbway",
                                "telefone": "912345678"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalInstrucoesPagamento"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "pagamento_id": 204,
                                        "metodo": "mbway",
                                        "valor": 500,
                                        "mb_entidade": null,
                                        "mb_referencia": null,
                                        "mb_validade": null,
                                        "url": null,
                                        "mensagem": "Aceite o pedido na aplicação MB WAY nos próximos minutos."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — pagamentos"
                ],
                "operationId": "portalPagar",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/pagamentos/{id}/pagar": {
            "post": {
                "tags": [
                    "Portal — propostas e pagamentos"
                ],
                "operationId": "m5PortalPagar",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Pay",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "metodo": {
                                        "type": "string",
                                        "enum": [
                                            "mbway",
                                            "multibanco",
                                            "ligacao"
                                        ]
                                    },
                                    "telefone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "metodo"
                                ]
                            },
                            "example": {
                                "metodo": "mbway",
                                "telefone": "912345678"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5PagamentoPaciente"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/portal/plano": {
            "get": {
                "summary": "My plan: approved plans, 3D models and proposals",
                "description": "Only what the doctor shared: plans with status «approved» (no clinical notes), 3D models whose file is shared, and sent proposals. Switches: portal.mostrar_plano, _modelo3d, _simulacao, _propostas.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "planos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalPlano"
                                                    }
                                                },
                                                "propostas": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalProposta"
                                                    }
                                                },
                                                "modelos3d": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "aviso": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "planos": [
                                            {
                                                "id": 41,
                                                "versao": 2,
                                                "episodio": {
                                                    "id": 19,
                                                    "titulo": "FUE couro cabeludo",
                                                    "numero": "E-2026-0019",
                                                    "etapa": 5
                                                },
                                                "tecnica": "FUE",
                                                "enxertos_necessarios": 2850,
                                                "sessoes": 1,
                                                "cenario": "provavel",
                                                "cenario_rotulo": "Provável",
                                                "aprovado_em": "2026-10-20T16:05:00+00:00",
                                                "aprovado_por": "Dr. Rui Matos",
                                                "zonas": [
                                                    {
                                                        "zona": "linha_frontal",
                                                        "zona_rotulo": "Linha frontal",
                                                        "area_cm2": 18.5,
                                                        "densidade_alvo": 45,
                                                        "enxertos": 830
                                                    },
                                                    {
                                                        "zona": "frontal",
                                                        "zona_rotulo": "Zona frontal",
                                                        "area_cm2": 52,
                                                        "densidade_alvo": 38,
                                                        "enxertos": 1976
                                                    }
                                                ],
                                                "area_total_cm2": 70.5,
                                                "simulacao": {
                                                    "disponivel": true,
                                                    "aviso_aceite_em": null,
                                                    "url": null
                                                }
                                            }
                                        ],
                                        "propostas": [
                                            {
                                                "id": 77,
                                                "numero": "PR-2026-0077",
                                                "estado": "vista",
                                                "estado_rotulo": "Vista",
                                                "total": 4980,
                                                "moeda": "EUR",
                                                "validade_ate": "2026-11-30",
                                                "enviada_em": "2026-10-21T09:00:00+00:00",
                                                "aceite_em": null,
                                                "pode_aceitar": true,
                                                "pdf_url": "https://anagen.pt/f/eyJmIjo5MTIs….Xk2",
                                                "linhas": [
                                                    {
                                                        "descricao": "Transplante FUE — 2850 enxertos",
                                                        "quantidade": 2850,
                                                        "unidade": "enxertos",
                                                        "valor": 4980
                                                    }
                                                ],
                                                "opcoes": [],
                                                "subtotal": 4980,
                                                "desconto_valor": null,
                                                "iva_valor": null,
                                                "prestacoes": [
                                                    {
                                                        "descricao": "Sinal",
                                                        "valor": 500,
                                                        "data": "2026-11-05"
                                                    }
                                                ],
                                                "opcao_aceite": null,
                                                "plano_id": 41
                                            }
                                        ],
                                        "modelos3d": [
                                            {
                                                "id": 8,
                                                "formato": "glb",
                                                "ficheiro_id": 9001,
                                                "nome": "captura.glb",
                                                "tamanho": 4810233,
                                                "data": "2026-10-15T10:00:00+00:00",
                                                "visualizavel": true
                                            }
                                        ],
                                        "aviso": "Ilustrativo, sem garantia de resultado."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — plano"
                ],
                "operationId": "portalPlano",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/plano/modelos3d/{id}": {
            "get": {
                "summary": "Link to the shared 3D model",
                "description": "Returns a 30-minute signed link to the file (GLB, PLY, OBJ, STL or USDZ). The access is audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "3D model"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "formato": {
                                                    "type": "string"
                                                },
                                                "url": {
                                                    "type": "string"
                                                },
                                                "nome": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 8,
                                        "formato": "glb",
                                        "url": "https://anagen.pt/f/eyJmIjo5MDAx….m",
                                        "nome": "captura.glb"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — plano"
                ],
                "operationId": "portalModelo3d",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/plano/{id}/simulacao": {
            "post": {
                "summary": "Accept the simulation notice and get the image",
                "description": "Records acknowledgement of «Illustrative, with no guarantee of results» (planos.simulacao_aviso_aceite_em, proof in portal_leituras and audit) and returns the plan with simulacao.url (15 min). Effects: patient timeline.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Plan"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalPlano"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 41,
                                        "versao": 2,
                                        "episodio": {
                                            "id": 19,
                                            "titulo": "FUE couro cabeludo",
                                            "numero": "E-2026-0019",
                                            "etapa": 5
                                        },
                                        "tecnica": "FUE",
                                        "enxertos_necessarios": 2850,
                                        "sessoes": 1,
                                        "cenario": "provavel",
                                        "cenario_rotulo": "Provável",
                                        "aprovado_em": "2026-10-20T16:05:00+00:00",
                                        "aprovado_por": "Dr. Rui Matos",
                                        "zonas": [
                                            {
                                                "zona": "linha_frontal",
                                                "zona_rotulo": "Linha frontal",
                                                "area_cm2": 18.5,
                                                "densidade_alvo": 45,
                                                "enxertos": 830
                                            },
                                            {
                                                "zona": "frontal",
                                                "zona_rotulo": "Zona frontal",
                                                "area_cm2": 52,
                                                "densidade_alvo": 38,
                                                "enxertos": 1976
                                            }
                                        ],
                                        "area_total_cm2": 70.5,
                                        "simulacao": {
                                            "disponivel": true,
                                            "aviso_aceite_em": "2026-10-28T10:15:00+00:00",
                                            "url": "https://anagen.pt/f/eyJmIjo5NTUx….k"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — plano"
                ],
                "operationId": "portalAceitarAvisoSimulacao",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/propostas": {
            "get": {
                "tags": [
                    "Portal — propostas e pagamentos"
                ],
                "operationId": "m5PortalPropostas",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente",
                "summary": "My proposals",
                "description": "Only proposals sent to the patient themself (never drafts).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "numero": {
                                                        "type": "string"
                                                    },
                                                    "titulo": {
                                                        "type": "string"
                                                    },
                                                    "estado": {
                                                        "type": "string",
                                                        "enum": [
                                                            "rascunho",
                                                            "enviada",
                                                            "vista",
                                                            "aceite",
                                                            "recusada",
                                                            "expirada"
                                                        ]
                                                    },
                                                    "estado_rotulo": {
                                                        "type": "string"
                                                    },
                                                    "total": {
                                                        "type": "number",
                                                        "x-unidade": "EUR"
                                                    },
                                                    "moeda": {
                                                        "type": "string"
                                                    },
                                                    "validade_ate": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date"
                                                    },
                                                    "enviada_em": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "aceite_em": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/portal/propostas/{id}": {
            "get": {
                "summary": "Proposal detail",
                "description": "Lines, options, totals, instalments and PDF. The first opening marks the proposal as «viewed» (vista_em) and records the reading.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Proposal"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalProposta"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 77,
                                        "numero": "PR-2026-0077",
                                        "estado": "vista",
                                        "estado_rotulo": "Vista",
                                        "total": 4980,
                                        "moeda": "EUR",
                                        "validade_ate": "2026-11-30",
                                        "enviada_em": "2026-10-21T09:00:00+00:00",
                                        "aceite_em": null,
                                        "pode_aceitar": true,
                                        "pdf_url": "https://anagen.pt/f/eyJmIjo5MTIs….Xk2",
                                        "linhas": [
                                            {
                                                "descricao": "Transplante FUE — 2850 enxertos",
                                                "quantidade": 2850,
                                                "unidade": "enxertos",
                                                "valor": 4980
                                            }
                                        ],
                                        "opcoes": [],
                                        "subtotal": 4980,
                                        "desconto_valor": null,
                                        "iva_valor": null,
                                        "prestacoes": [
                                            {
                                                "descricao": "Sinal",
                                                "valor": 500,
                                                "data": "2026-11-05"
                                            }
                                        ],
                                        "opcao_aceite": null,
                                        "plano_id": 41
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — plano"
                ],
                "operationId": "portalProposta",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/propostas/{id}/aceitar": {
            "post": {
                "summary": "Accept a proposal with signature",
                "description": "Requires aceito = true, the signature (PNG in base64 or data URL) and the option when the proposal has options. Uses Comercial\\Propostas::aceitar when available; otherwise records the acceptance, processes commissions and fires the proposta.aceite webhook. Effects: notification to the sales owner, timeline, «assinar» audit.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Proposal"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "aceito": {
                                        "type": "boolean"
                                    },
                                    "assinatura": {
                                        "type": "string",
                                        "contentEncoding": "base64",
                                        "contentMediaType": "image/png"
                                    },
                                    "opcao": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "aceito",
                                    "assinatura"
                                ]
                            },
                            "example": {
                                "aceito": true,
                                "assinatura": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA…",
                                "opcao": null
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PortalProposta"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 77,
                                        "numero": "PR-2026-0077",
                                        "estado": "aceite",
                                        "estado_rotulo": "Aceite",
                                        "total": 4980,
                                        "moeda": "EUR",
                                        "validade_ate": "2026-11-30",
                                        "enviada_em": "2026-10-21T09:00:00+00:00",
                                        "aceite_em": "2026-10-28T10:20:00+00:00",
                                        "pode_aceitar": false,
                                        "pdf_url": "https://anagen.pt/f/eyJmIjo5MTIs….Xk2",
                                        "linhas": [
                                            {
                                                "descricao": "Transplante FUE — 2850 enxertos",
                                                "quantidade": 2850,
                                                "unidade": "enxertos",
                                                "valor": 4980
                                            }
                                        ],
                                        "opcoes": [],
                                        "subtotal": 4980,
                                        "desconto_valor": null,
                                        "iva_valor": null,
                                        "prestacoes": [
                                            {
                                                "descricao": "Sinal",
                                                "valor": 500,
                                                "data": "2026-11-05"
                                            }
                                        ],
                                        "opcao_aceite": null,
                                        "plano_id": 41
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — plano"
                ],
                "operationId": "portalAceitarProposta",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/propostas/{id}/recusar": {
            "post": {
                "tags": [
                    "Portal — propostas e pagamentos"
                ],
                "operationId": "m5PortalRecusar",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Decline",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M5PropostaPublica"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/portal/recuperacao": {
            "get": {
                "summary": "Recovery timeline and instructions",
                "description": "Surgery, milestones (marcos_acompanhamento or calculated calendar), current stage, progress, stage content (knowledge base, site blocks or general guidance; videos only from the clinic itself) and discharge instructions (no medication).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "cirurgia": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ]
                                                },
                                                "marcos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalMarco"
                                                    }
                                                },
                                                "fase": {
                                                    "type": "object"
                                                },
                                                "progresso": {
                                                    "type": "object",
                                                    "properties": {
                                                        "feitos": {
                                                            "type": "integer"
                                                        },
                                                        "total": {
                                                            "type": "integer"
                                                        },
                                                        "pct": {
                                                            "type": "integer",
                                                            "x-unidade": "%"
                                                        }
                                                    }
                                                },
                                                "fases": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "conteudos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalConteudoFase"
                                                    }
                                                },
                                                "alta": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "cirurgia": {
                                            "id": 31,
                                            "data": "2026-10-20T08:00:00+00:00",
                                            "tecnica": "FUE",
                                            "dias": 8
                                        },
                                        "marcos": [
                                            {
                                                "id": 66,
                                                "marco": "m1",
                                                "titulo": "1 mês",
                                                "data_prevista": "2026-11-20",
                                                "estado": "pendente",
                                                "estado_rotulo": "Por fazer",
                                                "feito": false,
                                                "passado": false,
                                                "pede_fotos": false,
                                                "marcacao_id": null,
                                                "calculado": false
                                            }
                                        ],
                                        "fase": {
                                            "chave": "s1",
                                            "titulo": "Primeira semana",
                                            "data": "2026-10-27"
                                        },
                                        "progresso": {
                                            "feitos": 1,
                                            "total": 8,
                                            "pct": 13
                                        },
                                        "conteudos": [
                                            {
                                                "origem": "geral",
                                                "titulo": "A primeira semana",
                                                "html": null,
                                                "itens": [
                                                    "Lave a cabeça apenas como lhe foi ensinado na primeira lavagem."
                                                ],
                                                "videos": []
                                            }
                                        ],
                                        "alta": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — recuperação"
                ],
                "operationId": "portalRecuperacao",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/portal/recuperacao/fases/{fase}": {
            "get": {
                "summary": "Content of a stage",
                "parameters": [
                    {
                        "name": "fase",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pre",
                                "d1",
                                "s1",
                                "m1",
                                "m2",
                                "m6",
                                "m9",
                                "m12",
                                "m18"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "chave": {
                                                    "type": "string"
                                                },
                                                "titulo": {
                                                    "type": "string"
                                                },
                                                "conteudos": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/PortalConteudoFase"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "chave": "m1",
                                        "titulo": "1 mês",
                                        "conteudos": []
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Portal — recuperação"
                ],
                "operationId": "portalFaseRecuperacao",
                "security": [
                    {
                        "paciente": []
                    }
                ],
                "x-anagen-modulo": "portal",
                "x-anagen-nivel": "paciente"
            }
        },
        "/postman.json": {
            "get": {
                "tags": [
                    "Integrações"
                ],
                "operationId": "colecaoPostman",
                "security": [],
                "summary": "Test collection (Postman 2.1 format)",
                "responses": {
                    "200": {
                        "description": "Collection",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/primeiros-passos": {
            "get": {
                "tags": [
                    "Definições"
                ],
                "operationId": "primeirosPassos",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Clinic first steps (setup assistant)",
                "description": "Steps dados_legais, equipa, horarios, tipos_marcacao, consentimentos, motor, pagamentos, faturacao, email and canais, each with a state (feito|por_fazer|dispensado|nao_aplicavel), detail and link {web, app}; the state is computed from the existing configuration. Requires Settings › Edit.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "passos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "chave": {
                                                                "type": "string"
                                                            },
                                                            "titulo": {
                                                                "type": "string"
                                                            },
                                                            "descricao": {
                                                                "type": "string"
                                                            },
                                                            "acao": {
                                                                "type": "string"
                                                            },
                                                            "icone": {
                                                                "type": "string"
                                                            },
                                                            "estado": {
                                                                "type": "string"
                                                            },
                                                            "estado_rotulo": {
                                                                "type": "string"
                                                            },
                                                            "detalhe": {
                                                                "type": "string"
                                                            },
                                                            "feito": {
                                                                "type": "boolean"
                                                            },
                                                            "dispensavel": {
                                                                "type": "boolean"
                                                            },
                                                            "ligacao": {
                                                                "type": "object"
                                                            }
                                                        }
                                                    }
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "feitos": {
                                                    "type": "integer"
                                                },
                                                "em_falta": {
                                                    "type": "integer"
                                                },
                                                "percentagem": {
                                                    "type": "integer"
                                                },
                                                "concluido": {
                                                    "type": "boolean"
                                                },
                                                "proximo": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/primeiros-passos/{passo}/dispensar": {
            "post": {
                "tags": [
                    "Definições"
                ],
                "operationId": "dispensarPrimeiroPasso",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "passo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "summary": "Dismiss (or restore) a step",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "dispensar": {
                                        "type": "boolean"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/procurar": {
            "get": {
                "tags": [
                    "Sessão"
                ],
                "operationId": "procurar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "summary": "Global search",
                "description": "Patients, leads, records and screens the profile can see. Never returns clinical content to profiles without access.",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 80
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "tipo": {
                                                        "type": "string"
                                                    },
                                                    "titulo": {
                                                        "type": "string"
                                                    },
                                                    "subtitulo": {
                                                        "type": "string"
                                                    },
                                                    "url": {
                                                        "type": "string"
                                                    },
                                                    "icone": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    }
                }
            }
        },
        "/proposta/{token}": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Proposta pública"
                ],
                "operationId": "m5PublicaVer",
                "security": [],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "publico",
                "summary": "Proposal page (HTML)",
                "description": "Shows the proposal with the branding and legal data of the clinic that owns it, in pt or en (proposal language or ?lingua=). First opening marks «vista». Invalid, revised or expired link → informative page.",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "HTML page",
                        "content": {
                            "text/html": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Invalid link"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/proposta/{token}/aceitar": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Proposta pública"
                ],
                "operationId": "m5PublicaAceitar",
                "security": [],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "publico",
                "summary": "Accept (form)",
                "description": "Form with CSRF and honeypot; limit of 8 submissions per 10 minutes. Verifies the seal, stores the proof and creates the payment plan.",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "opcao",
                                    "nome",
                                    "aceitar"
                                ],
                                "properties": {
                                    "opcao": {
                                        "type": "string"
                                    },
                                    "nome": {
                                        "type": "string"
                                    },
                                    "assinatura": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "prestacoes": {
                                        "type": "integer"
                                    },
                                    "aceitar": {
                                        "const": "1"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "303": {
                        "description": "Back to the proposal page"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/proposta/{token}/estado": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Proposta pública"
                ],
                "operationId": "m5PublicaEstado",
                "security": [],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "publico",
                "summary": "Proposal payments status",
                "description": "Used by the page to follow MB WAY: list of payments (id, type, amount, status).",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M5PagamentoPaciente"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/proposta/{token}/pagar": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Proposta pública"
                ],
                "operationId": "m5PublicaPagar",
                "security": [],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "publico",
                "summary": "Pay the proposal's next payment",
                "description": "Only this proposal's first unpaid payment, through the owning clinic's provider and credentials. Payment link → redirects to the provider page.",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "metodo"
                                ],
                                "properties": {
                                    "metodo": {
                                        "type": "string",
                                        "enum": [
                                            "mbway",
                                            "multibanco",
                                            "ligacao"
                                        ]
                                    },
                                    "telefone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "303": {
                        "description": "Proposal or provider page"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/proposta/{token}/pdf": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Proposta pública"
                ],
                "operationId": "m5PublicaPdf",
                "security": [],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "publico",
                "summary": "Proposal PDF",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "PDF",
                        "content": {
                            "application/pdf": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/proposta/{token}/recusar": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Proposta pública"
                ],
                "operationId": "m5PublicaRecusar",
                "security": [],
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "publico",
                "summary": "Decline (form)",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "303": {
                        "description": "Back to the proposal page"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/publico/apresentacao": {
            "get": {
                "summary": "AnagenSys presentation content",
                "description": "No session. Returns every section of the product page in the requested language (pt or en; other languages get English), the demo form options, the time seal and the trap field name. Records an anonymous visit («apresentacao» area). Limit: 60 requests per minute per IP.",
                "parameters": [
                    {
                        "name": "lingua",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pt",
                                "pt_BR",
                                "en",
                                "es",
                                "fr",
                                "de"
                            ]
                        },
                        "description": "App language; without it Accept-Language is used."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ApresentacaoConteudo"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "idioma": "pt",
                                        "seccoes": {
                                            "hero": {
                                                "hero_titulo": "Da primeira mensagem ao resultado aos 18 meses, *num só sistema*.",
                                                "hero_provas": [
                                                    {
                                                        "valor": "425",
                                                        "unidade": "",
                                                        "rotulo": "funcionalidades levantadas"
                                                    }
                                                ]
                                            },
                                            "funcionalidades": {
                                                "total": 425
                                            }
                                        },
                                        "formulario": {
                                            "especialidades": [
                                                {
                                                    "valor": "capilar",
                                                    "rotulo": "Cirurgia capilar"
                                                }
                                            ],
                                            "paises": [
                                                {
                                                    "valor": "PT",
                                                    "rotulo": "Portugal"
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "titulo": "AnagenSys — plataforma clínica para cirurgia capilar",
                                            "descricao": "CRM, ficha clínica, planeamento…",
                                            "imagem": "https://anagen.pt/apresentacao/partilha.png"
                                        },
                                        "urls": {
                                            "pt": "https://anagen.pt/apresentacao",
                                            "en": "https://anagen.pt/en/presentation",
                                            "pdf": "https://anagen.pt/apresentacao/pdf",
                                            "desenvolvedores": "https://anagen.pt/desenvolvedores"
                                        },
                                        "selo": "MTczMDEwOTYwMC5hcHJlc2VudGFjYW8uOWYx…",
                                        "armadilha": "website_url"
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Apresentação do AnagenSys"
                ],
                "operationId": "apresentacaoConteudo",
                "security": [],
                "x-anagen-modulo": "publico",
                "x-anagen-nivel": "publico"
            }
        },
        "/publico/apresentacao/pedido": {
            "post": {
                "summary": "Request an AnagenSys demo",
                "description": "No session. Validated by value lists, types and lengths; contact consent is required. Protections: 5 submissions per 10 minutes per IP, hourly limit in settings, time seal (_selo) and empty trap field — a bot gets 201 with nothing stored (null id). Effects: request on the platform board, notification and email alert, confirmation email to the requester and «demonstracao.pedida» webhook.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": "string",
                                        "minLength": 2,
                                        "maxLength": 160
                                    },
                                    "clinica_nome": {
                                        "type": "string",
                                        "minLength": 2,
                                        "maxLength": 190
                                    },
                                    "cargo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 120
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "maxLength": 190
                                    },
                                    "telefone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "pattern": "^[0-9+() .-]{6,25}$"
                                    },
                                    "pais": {
                                        "type": "string",
                                        "pattern": "^[A-Z]{2}$"
                                    },
                                    "especialidade": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "capilar",
                                            "dermatologia",
                                            "estetica",
                                            "cirurgia_plastica",
                                            "dentaria",
                                            "oftalmologia",
                                            "outra",
                                            null
                                        ]
                                    },
                                    "cirurgioes_n": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 500
                                    },
                                    "cirurgias_mes": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 5000
                                    },
                                    "sistemas_atuais": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 500
                                    },
                                    "mensagem": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 3000
                                    },
                                    "consentimento_contacto": {
                                        "const": true
                                    },
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt",
                                            "en"
                                        ]
                                    },
                                    "utm_source": {
                                        "type": "string"
                                    },
                                    "utm_medium": {
                                        "type": "string"
                                    },
                                    "utm_campaign": {
                                        "type": "string"
                                    },
                                    "_selo": {
                                        "type": "string"
                                    },
                                    "website_url": {
                                        "type": "string",
                                        "maxLength": 0,
                                        "description": "Trap field: must be empty (the name comes in «armadilha»)."
                                    }
                                },
                                "required": [
                                    "nome",
                                    "clinica_nome",
                                    "email",
                                    "pais",
                                    "consentimento_contacto",
                                    "_selo"
                                ]
                            },
                            "example": {
                                "nome": "Marta Ribeiro",
                                "clinica_nome": "Clínica Capilar do Norte",
                                "cargo": "Diretora clínica",
                                "email": "marta@capilarnorte.pt",
                                "telefone": "+351 912 345 678",
                                "pais": "PT",
                                "especialidade": "capilar",
                                "cirurgioes_n": 2,
                                "cirurgias_mes": 24,
                                "consentimento_contacto": true,
                                "idioma": "pt",
                                "_selo": "MTczMDEwOTYwMC5…",
                                "website_url": ""
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "titulo": {
                                                    "type": "string"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 58,
                                        "titulo": "Pedido recebido",
                                        "mensagem": "Obrigado. A equipa do produto contacta-o num dia útil para combinar a demonstração."
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Apresentação do AnagenSys"
                ],
                "operationId": "apresentacaoPedido",
                "security": [],
                "x-anagen-modulo": "publico",
                "x-anagen-nivel": "publico"
            }
        },
        "/publico/avisos/{contexto}": {
            "get": {
                "tags": [
                    "Consentimentos"
                ],
                "operationId": "m2AvisoPublico",
                "security": [],
                "x-anagen-modulo": "publico",
                "x-anagen-nivel": "publico",
                "parameters": [
                    {
                        "name": "contexto",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pre_avaliacao",
                                "contacto_chamada",
                                "contacto_marcacao",
                                "contacto_reclamacao",
                                "portal_registo",
                                "demonstracao",
                                "formulario"
                            ]
                        }
                    },
                    {
                        "name": "lingua",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "pt, pt_BR, en, es, fr, de (without that language: English, then Portuguese)."
                    },
                    {
                        "name": "X-AX-Clinica",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "summary": "Privacy notice in force for a form",
                "description": "No session. Returns the versioned notice of the context channel (or null) and the token of the version shown; send it as «aviso_testemunho» with the form to record the display. «demonstracao» always belongs to the main clinic. Limit: 60 per minute.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M2AvisoCanal"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "contexto": {
                                                    "type": "string"
                                                },
                                                "canal": {
                                                    "type": "string"
                                                },
                                                "clinica_id": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/publico/chat": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "post": {
                "tags": [
                    "Chat do site e subscrições"
                ],
                "operationId": "chatSiteEnviar",
                "security": [],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "publico",
                "summary": "Website chat",
                "description": "No session; used by the site widget (sends the site CSRF code). Actions: iniciar (name, email or phone, text, consent → returns the conversation token), mensagem, disponibilidade (free slots), marcar (booking request for the front desk) and avaliar (1-5). Trap field «website_url»: if filled, the response looks successful and nothing is stored. The clinic is the site's public clinic. Limit: 20 per minute per IP.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "acao": {
                                        "type": "string",
                                        "enum": [
                                            "iniciar",
                                            "mensagem",
                                            "marcar",
                                            "avaliar",
                                            "disponibilidade"
                                        ]
                                    },
                                    "token": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{32}$"
                                    },
                                    "nome": {
                                        "type": "string",
                                        "maxLength": 160
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "telefone": {
                                        "type": "string",
                                        "maxLength": 30
                                    },
                                    "texto": {
                                        "type": "string",
                                        "maxLength": 2000
                                    },
                                    "consentimento": {
                                        "type": "boolean"
                                    },
                                    "preferencia": {
                                        "type": "string",
                                        "maxLength": 300
                                    },
                                    "inicio": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "nota": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 5
                                    },
                                    "website_url": {
                                        "type": "string",
                                        "maxLength": 0
                                    }
                                },
                                "required": [
                                    "acao"
                                ]
                            },
                            "example": {
                                "acao": "iniciar",
                                "nome": "Ana Lopes",
                                "email": "ana.lopes@exemplo.pt",
                                "texto": "Boa tarde, fazem implante de sobrancelhas?",
                                "consentimento": true,
                                "website_url": ""
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "token": {
                                                    "type": "string"
                                                },
                                                "mensagens": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "horarios": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "token": "3f9c2e7a1b4d5c6e8f0a1b2c3d4e5f60",
                                        "mensagens": [
                                            {
                                                "id": 1,
                                                "direcao": "saida",
                                                "corpo": "Olá! Em que podemos ajudar?",
                                                "ia": false,
                                                "criado_em": "2026-10-28T15:01:00+00:00"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/publico/chat/{token}": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Chat do site e subscrições"
                ],
                "operationId": "chatSiteMensagens",
                "security": [],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "publico",
                "summary": "Website chat messages",
                "description": "Exchanged messages (no internal notes), conversation status and whether rating is available. Only with the token returned by «iniciar» (stored only as a cryptographic digest). Limit: 40 per minute.",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{32}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagens": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "estado": {
                                                    "type": "string"
                                                },
                                                "pode_avaliar": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/publico/clinica": {
            "get": {
                "tags": [
                    "Clínica pública"
                ],
                "operationId": "clinicaPublica",
                "security": [],
                "summary": "Resolved public clinic",
                "description": "By the X-AX-Clinica header (code) or by the request host (verified domains); falls back to the server public clinic.",
                "parameters": [
                    {
                        "name": "X-AX-Clinica",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "PORTO-HAIR"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ClinicaPublica"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/publico/clinica/{codigo}": {
            "get": {
                "tags": [
                    "Clínica pública"
                ],
                "operationId": "clinicaPorCodigo",
                "security": [],
                "summary": "Clinic by code (app choice)",
                "description": "Public data only. 30 requests per minute per IP. disponivel = false when the licence blocks the clinic.",
                "parameters": [
                    {
                        "name": "codigo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z][A-Za-z0-9-]{2,23}$"
                        },
                        "example": "PORTO-HAIR"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ClinicaPublica"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "codigo": "PORTO-HAIR",
                                        "nome": "Clínica Capilar Porto",
                                        "localidade": "Porto",
                                        "logotipo_url": null,
                                        "cor_marca": "#0E5B4F",
                                        "disponivel": true,
                                        "mensagem": null
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/publico/formularios/{token}": {
            "get": {
                "tags": [
                    "Formulários por ligação"
                ],
                "operationId": "m1FormularioPorLigacao",
                "security": [],
                "x-anagen-modulo": "publico",
                "x-anagen-nivel": "publico",
                "summary": "Form, schema and pre-fill",
                "description": "No authentication. The host clinic (or the X-AX-Clinica header) is resolved first, but the request record defines the clinic. Only «pendente» requests within the deadline (past it they become «expirado»); otherwise 404 «ligacao_invalida». Returns the schema of the request version, the pre-fill values (the patient previous responses to the same form, without photos nor signatures), the deadline, the information request when the response was returned and the clinic name. Compatible additions: «consentimentos» (missing authorisations, to show as boxes never pre-ticked), «aviso» (privacy notice in force for the «formulario» channel, with the token to return on submit) and «armadilha» (name of the field that must be sent empty). Limit: 60 requests per 10 minutes per IP address, reads included (429 with Retry-After).",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_\\-]{30,60}$"
                        },
                        "example": "q3V9k1sXw7bE2mN4tR8yU0pL6aZ5cH1dF9gJ3kM2nB4",
                        "description": "Link token (32 random bytes in base64url; only its SHA-256 is stored). Identifies the request, the patient and the clinic."
                    },
                    {
                        "$ref": "#/components/parameters/XAxClinica"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1FormularioPublico"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "formulario": {
                                            "id": 31,
                                            "nome": "Questionário prévio — FUE",
                                            "descricao": "A preencher antes da primeira consulta.",
                                            "idioma": "pt-PT",
                                            "tipo": "questionario_previo"
                                        },
                                        "esquema": {
                                            "passos": [
                                                {
                                                    "chave": "p1",
                                                    "titulo": "Saúde geral",
                                                    "descricao": "",
                                                    "seccoes": [
                                                        {
                                                            "chave": "s1_1",
                                                            "titulo": "Antecedentes",
                                                            "descricao": "",
                                                            "perguntas": [
                                                                {
                                                                    "chave": "anticoagulantes",
                                                                    "tipo": "simnao",
                                                                    "rotulo": "Toma anticoagulantes?",
                                                                    "ajuda": "",
                                                                    "obrigatorio": true,
                                                                    "preencher": true,
                                                                    "pontos_sim": null,
                                                                    "alarme_sim": true,
                                                                    "alerta": {
                                                                        "tipo": "anticoagulante",
                                                                        "gravidade": "alta",
                                                                        "quando": [
                                                                            "sim"
                                                                        ]
                                                                    }
                                                                },
                                                                {
                                                                    "chave": "qual_anticoagulante",
                                                                    "tipo": "texto",
                                                                    "rotulo": "Qual?",
                                                                    "ajuda": "",
                                                                    "obrigatorio": false,
                                                                    "preencher": true,
                                                                    "max": 200,
                                                                    "condicao": {
                                                                        "pergunta": "anticoagulantes",
                                                                        "operador": "=",
                                                                        "valor": "sim"
                                                                    }
                                                                },
                                                                {
                                                                    "chave": "impacto",
                                                                    "tipo": "escala",
                                                                    "rotulo": "Quanto o incomoda a queda de cabelo?",
                                                                    "ajuda": "",
                                                                    "obrigatorio": true,
                                                                    "preencher": false,
                                                                    "min": 0,
                                                                    "max": 10,
                                                                    "passo": 1,
                                                                    "rotulo_min": "Nada",
                                                                    "rotulo_max": "Muito",
                                                                    "pontuar": true,
                                                                    "alarme_min": null
                                                                }
                                                            ]
                                                        }
                                                    ]
                                                }
                                            ],
                                            "pontuacao": {
                                                "ativa": true,
                                                "rotulo": "Impacto",
                                                "modo": "soma",
                                                "pergunta": null,
                                                "faixas": [
                                                    {
                                                        "min": 0,
                                                        "max": 4,
                                                        "rotulo": "Baixo",
                                                        "tom": "sucesso"
                                                    },
                                                    {
                                                        "min": 5,
                                                        "max": 10,
                                                        "rotulo": "Elevado",
                                                        "tom": "aviso"
                                                    }
                                                ]
                                            },
                                            "alarmes": {
                                                "departamento": "enfermagem"
                                            }
                                        },
                                        "valores": [],
                                        "consentimentos": [
                                            {
                                                "finalidade": "tratamento_clinico",
                                                "texto": "Autorizo a clínica a tratar os dados de saúde deste questionário para a minha avaliação e acompanhamento clínico.",
                                                "modelo_id": 12
                                            }
                                        ],
                                        "aviso": {
                                            "id": 4,
                                            "canal": "formulario",
                                            "canal_rotulo": "Formulários",
                                            "versao": 2,
                                            "titulo": "Como tratamos os seus dados",
                                            "texto": "<p>…</p>",
                                            "idioma": "pt-PT",
                                            "publicado_em": "2026-10-20T10:00:00+00:00",
                                            "resumo": null,
                                            "contexto": "formulario",
                                            "testemunho": "eyJhIjo0LCJ2IjoyfQ.…"
                                        },
                                        "expira_em": "2026-11-12T09:40:00+00:00",
                                        "devolucao_motivo": null,
                                        "clinica": "Clínica Exemplo Porto",
                                        "armadilha": "honeypot"
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Link not found, expired or already answered (ligacao_invalida)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M1RespostaErro"
                                },
                                "example": {
                                    "ok": false,
                                    "erro": {
                                        "codigo": "ligacao_invalida",
                                        "mensagem": "Esta ligação já não é válida."
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Formulários por ligação"
                ],
                "operationId": "m1ResponderPorLigacao",
                "security": [],
                "x-anagen-modulo": "publico",
                "x-anagen-nivel": "publico",
                "summary": "Submit the answers",
                "description": "No authentication (Idempotency-Key does not apply). Answers validated against the request version schema (same rules as POST /formularios/{id}/respostas; errors → 422 with the question key). Photo questions only accept files uploaded for this request. The response is always «por_validar» («paciente» source) and the token stops working. The patient only gets a receipt — never the score nor the alarms. Effects: encrypted answers, alerts awaiting validation, alarm → urgent task and notice to the department, pre-assessment → medical review task, timeline, audit, formulario.respondido webhook. Consent required before saving: «tratamento_clinico» (and «fotografias_clinicas» when there are photos) already recorded or declared in «consentimentos»; without it 422 with the per-field error «consentimentos.<finalidade>» and nothing is saved (the answers stay on screen). Declarations are recorded immutably («formulario_site» channel). With «aviso_testemunho», the privacy notice version shown is recorded. Trap field filled → 201 with a null resposta_id and nothing saved. Limit: 10 requests per 10 minutes per IP address (429 with Retry-After).",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_\\-]{30,60}$"
                        },
                        "example": "q3V9k1sXw7bE2mN4tR8yU0pL6aZ5cH1dF9gJ3kM2nB4",
                        "description": "Link token (32 random bytes in base64url; only its SHA-256 is stored). Identifies the request, the patient and the clinic."
                    },
                    {
                        "$ref": "#/components/parameters/XAxClinica"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "respostas": {
                                        "type": "object",
                                        "additionalProperties": true,
                                        "description": "Question key → value."
                                    },
                                    "idioma": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de",
                                            null
                                        ]
                                    },
                                    "consentimentos": {
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "boolean"
                                        },
                                        "description": "Declared consents: {finalidade: true}."
                                    },
                                    "aviso_testemunho": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Token of the notice shown (from «aviso» in the GET)."
                                    }
                                },
                                "required": [
                                    "respostas"
                                ]
                            },
                            "example": {
                                "respostas": {
                                    "anticoagulantes": "sim",
                                    "qual_anticoagulante": "Apixabano 5 mg",
                                    "impacto": 7
                                },
                                "idioma": "pt-PT",
                                "consentimentos": {
                                    "tratamento_clinico": true
                                },
                                "aviso_testemunho": "eyJhIjo0LCJ2IjoyfQ.…",
                                "honeypot": ""
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "recebido": {
                                                    "const": true
                                                },
                                                "resposta_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "recebido": true,
                                        "resposta_id": 5130
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Link not found, expired or already answered (ligacao_invalida)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M1RespostaErro"
                                },
                                "example": {
                                    "ok": false,
                                    "erro": {
                                        "codigo": "ligacao_invalida",
                                        "mensagem": "Esta ligação já não é válida."
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/publico/formularios/{token}/ficheiros": {
            "post": {
                "tags": [
                    "Formulários por ligação"
                ],
                "operationId": "m1FicheiroPorLigacao",
                "security": [],
                "x-anagen-modulo": "publico",
                "x-anagen-nivel": "publico",
                "summary": "Upload the photo of a question",
                "description": "No authentication. Images only, up to 15 MB: real type checked from the bytes, executable extensions refused, random name, stored outside the public area as a clinical file of the patient and tied to this request. No photo is collected before the «fotografias_clinicas» authorisation (already recorded or declared with consentimento_fotos = 1; otherwise 422 on «ficheiro»), as on the web page. Returns the identifier to use in the photo question answer. Missing or invalid file → 422. Limit: 30 requests per 10 minutes per IP address (429 with Retry-After).",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_\\-]{30,60}$"
                        },
                        "example": "q3V9k1sXw7bE2mN4tR8yU0pL6aZ5cH1dF9gJ3kM2nB4",
                        "description": "Link token (32 random bytes in base64url; only its SHA-256 is stored). Identifies the request, the patient and the clinic."
                    },
                    {
                        "$ref": "#/components/parameters/XAxClinica"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "Image up to 15 MB"
                                    },
                                    "consentimento_fotos": {
                                        "type": "string",
                                        "enum": [
                                            "0",
                                            "1"
                                        ],
                                        "description": "1 when the photo authorisation was ticked in the form."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "nome": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 9050,
                                        "nome": "topo.jpg"
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Link not found, expired or already answered (ligacao_invalida)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M1RespostaErro"
                                },
                                "example": {
                                    "ok": false,
                                    "erro": {
                                        "codigo": "ligacao_invalida",
                                        "mensagem": "Esta ligação já não é válida."
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/publico/pre-avaliacao": {
            "get": {
                "summary": "The clinic's online assessment form",
                "description": "No session. Questions (from the clinic's clinical form when present, otherwise the base questions), photo views, consents (always unticked), limits, texts and seal. Limit: 60 per minute per IP.",
                "parameters": [
                    {
                        "name": "lingua",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pt",
                                "pt_BR",
                                "en",
                                "es",
                                "fr",
                                "de"
                            ]
                        }
                    },
                    {
                        "name": "X-AX-Clinica",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Public clinic identifier (domain or code). Without it, the clinic is resolved from the request domain."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PreAvaliacaoEsquema"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ativo": true,
                                        "idioma": "pt",
                                        "titulo": "Pré-avaliação online",
                                        "passos": [
                                            {
                                                "chave": "privacidade",
                                                "titulo": "Antes de começar"
                                            }
                                        ],
                                        "perguntas": [
                                            {
                                                "chave": "idade",
                                                "passo": "sobre",
                                                "tipo": "numero",
                                                "obrigatorio": true,
                                                "rotulo": "Idade",
                                                "ajuda": "Em anos.",
                                                "opcoes": [],
                                                "min": 16,
                                                "max": 99
                                            }
                                        ],
                                        "vistas": [
                                            {
                                                "chave": "frontal",
                                                "titulo": "Frente",
                                                "instrucoes": "Olhe em frente, cabelo puxado para trás.",
                                                "obrigatoria": true
                                            }
                                        ],
                                        "consentimentos": [
                                            {
                                                "finalidade": "tratamento_clinico",
                                                "texto": "Autorizo o tratamento dos meus dados de saúde…",
                                                "obrigatorio": true,
                                                "valor": false
                                            }
                                        ],
                                        "limites": {
                                            "fotos_min": 3,
                                            "fotos_max": 5,
                                            "max_mb": 12
                                        },
                                        "selo": "MTczMDEwOTYwMC5…",
                                        "armadilha": "website_url"
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Pré-avaliação online"
                ],
                "operationId": "preAvaliacaoEsquema",
                "security": [],
                "x-anagen-modulo": "publico",
                "x-anagen-nivel": "publico"
            },
            "post": {
                "summary": "Submit the online assessment",
                "description": "No session. Required consents are checked before any data is stored. Answers are validated against the schema questions; photos are the tokens returned by POST /publico/pre-avaliacao/fotos (valid 24 h, same clinic). Effects: lead (online assessment source), consents recorded, encrypted answers, linked photos, medical review task, timeline, confirmation email without clinical content and «pre_avaliacao.recebida» webhook. The response never reveals the clinical triage: «triagem» is only «revisao» or «consulta». Limit: 5 per 10 minutes per IP.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    },
                    {
                        "name": "X-AX-Clinica",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Public clinic identifier (domain or code). Without it, the clinic is resolved from the request domain."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "lingua": {
                                        "type": "string",
                                        "enum": [
                                            "pt",
                                            "pt_BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ]
                                    },
                                    "respostas": {
                                        "type": "object",
                                        "description": "Question key → value (string, number, boolean or list for multiEscolha).",
                                        "additionalProperties": true
                                    },
                                    "consentimentos": {
                                        "type": "object",
                                        "description": "Purpose → true/false.",
                                        "additionalProperties": {
                                            "type": "boolean"
                                        }
                                    },
                                    "fotos": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "description": "Photo token."
                                        }
                                    },
                                    "consulta": {
                                        "type": "object",
                                        "description": "Required when consulta.ativa: format presencial | telefone | video; optional data (YYYY-MM-DD) and periodo (manha | tarde | fim_dia). Creates the appointment request with the matching calendar type.",
                                        "properties": {
                                            "modalidade": {
                                                "type": "string",
                                                "enum": [
                                                    "presencial",
                                                    "telefone",
                                                    "video"
                                                ]
                                            },
                                            "data": {
                                                "type": "string",
                                                "format": "date"
                                            },
                                            "periodo": {
                                                "type": "string",
                                                "enum": [
                                                    "manha",
                                                    "tarde",
                                                    "fim_dia"
                                                ]
                                            }
                                        }
                                    },
                                    "aviso_testemunho": {
                                        "type": "string",
                                        "description": "Token from the schema aviso.testemunho: records the version of the privacy notice shown."
                                    },
                                    "utm_source": {
                                        "type": "string"
                                    },
                                    "utm_medium": {
                                        "type": "string"
                                    },
                                    "utm_campaign": {
                                        "type": "string"
                                    },
                                    "_selo": {
                                        "type": "string"
                                    },
                                    "website_url": {
                                        "type": "string",
                                        "maxLength": 0
                                    }
                                },
                                "required": [
                                    "respostas",
                                    "consentimentos",
                                    "fotos",
                                    "_selo"
                                ]
                            },
                            "example": {
                                "lingua": "pt",
                                "respostas": {
                                    "nome": "João Costa",
                                    "email": "joao.costa@exemplo.pt",
                                    "telefone": "+351 913 222 111",
                                    "pais": "PT",
                                    "idade": 34,
                                    "area": "couro_cabeludo",
                                    "tempo_queda": "3_5",
                                    "cirurgia_anterior": "nao",
                                    "tratamentos": [
                                        "minoxidil"
                                    ]
                                },
                                "consentimentos": {
                                    "tratamento_clinico": true,
                                    "fotografias_clinicas": true,
                                    "contacto": true,
                                    "marketing": false
                                },
                                "fotos": [
                                    "ODgwMS5mcm9udGFsLjE3MzAy…",
                                    "ODgwMi50b3BvLjE3MzAy…",
                                    "ODgwMy5kYWRvcmEuMTczMDI…"
                                ],
                                "_selo": "MTczMDEwOTYwMC5…",
                                "website_url": ""
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "titulo": {
                                                    "type": "string"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                },
                                                "triagem": {
                                                    "type": "string",
                                                    "enum": [
                                                        "revisao",
                                                        "consulta"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 91,
                                        "titulo": "Recebemos a sua pré-avaliação",
                                        "mensagem": "Um médico vai rever o seu caso e respondemos por email.",
                                        "triagem": "revisao"
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Pré-avaliação online"
                ],
                "operationId": "preAvaliacaoEnviar",
                "security": [],
                "x-anagen-modulo": "publico",
                "x-anagen-nivel": "publico"
            }
        },
        "/publico/pre-avaliacao/fotos": {
            "post": {
                "summary": "Upload an online assessment photo",
                "description": "No session, multipart. Only accepted with consentimento_fotos = 1. The real type is checked from the bytes; the file is encrypted with the clinical key and stored outside the public area with a random name. Returns a signed token (24 h) to include in «fotos» on submission. Unused photos are deleted automatically. Limit: 40 per hour per IP.",
                "parameters": [
                    {
                        "name": "X-AX-Clinica",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Public clinic identifier (domain or code). Without it, the clinic is resolved from the request domain."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro",
                                    "vista",
                                    "consentimento_fotos"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "JPEG, PNG, WebP or HEIC up to the limit (limites.max_mb)."
                                    },
                                    "vista": {
                                        "type": "string",
                                        "enum": [
                                            "frontal",
                                            "topo",
                                            "coroa",
                                            "lateral",
                                            "dadora"
                                        ]
                                    },
                                    "consentimento_fotos": {
                                        "const": "1"
                                    },
                                    "lingua": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "token": {
                                                    "type": "string"
                                                },
                                                "vista": {
                                                    "type": "string"
                                                },
                                                "largura": {
                                                    "type": "integer"
                                                },
                                                "altura": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "token": "ODgwMS5mcm9udGFsLjE3MzAy…",
                                        "vista": "frontal",
                                        "largura": 3024,
                                        "altura": 4032
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Pré-avaliação online"
                ],
                "operationId": "preAvaliacaoFoto",
                "security": [],
                "x-anagen-modulo": "publico",
                "x-anagen-nivel": "publico"
            }
        },
        "/r/academia_certificados": {
            "get": {
                "tags": [
                    "Recurso: Certificates"
                ],
                "operationId": "listarAcademiaCertificados",
                "summary": "List Certificates",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Person». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[curso_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Course». List: a,b; range: f[curso_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[emitido_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Issued on». List: a,b; range: f[emitido_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_academia_certificados"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_certificados"
            }
        },
        "/r/academia_certificados/esquema": {
            "get": {
                "tags": [
                    "Recurso: Certificates"
                ],
                "operationId": "esquemaAcademiaCertificados",
                "summary": "Schema of «Certificates» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_certificados"
            }
        },
        "/r/academia_certificados/{id}": {
            "get": {
                "tags": [
                    "Recurso: Certificates"
                ],
                "operationId": "obterAcademiaCertificados",
                "summary": "Get Certificate",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_certificados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_certificados"
            }
        },
        "/r/academia_certificados/{id}/acao/revogar": {
            "post": {
                "tags": [
                    "Recurso: Certificates"
                ],
                "operationId": "acaoRevogarAcademiaCertificados",
                "summary": "Action: Revoke",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_certificados"
            }
        },
        "/r/academia_cursos": {
            "get": {
                "tags": [
                    "Recurso: Academy courses"
                ],
                "operationId": "listarAcademiaCursos",
                "summary": "List Academy courses",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[categoria]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Category». List: a,b; range: f[categoria][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_academia_cursos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_cursos"
            },
            "post": {
                "tags": [
                    "Recurso: Academy courses"
                ],
                "operationId": "criarAcademiaCursos",
                "summary": "Create Course",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_cursos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_cursos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_cursos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_cursos"
            }
        },
        "/r/academia_cursos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Academy courses"
                ],
                "operationId": "esquemaAcademiaCursos",
                "summary": "Schema of «Academy courses» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_cursos"
            }
        },
        "/r/academia_cursos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Academy courses"
                ],
                "operationId": "obterAcademiaCursos",
                "summary": "Get Course",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_cursos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_cursos"
            },
            "put": {
                "tags": [
                    "Recurso: Academy courses"
                ],
                "operationId": "alterarAcademiaCursos",
                "summary": "Update Course",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_cursos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_cursos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_cursos"
            },
            "delete": {
                "tags": [
                    "Recurso: Academy courses"
                ],
                "operationId": "apagarAcademiaCursos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_cursos"
            }
        },
        "/r/academia_licoes": {
            "get": {
                "tags": [
                    "Recurso: Lessons"
                ],
                "operationId": "listarAcademiaLicoes",
                "summary": "List Lessons",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[curso_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Course». List: a,b; range: f[curso_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_academia_licoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_licoes"
            },
            "post": {
                "tags": [
                    "Recurso: Lessons"
                ],
                "operationId": "criarAcademiaLicoes",
                "summary": "Create Lesson",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_licoes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_licoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_licoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_licoes"
            }
        },
        "/r/academia_licoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Lessons"
                ],
                "operationId": "esquemaAcademiaLicoes",
                "summary": "Schema of «Lessons» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_licoes"
            }
        },
        "/r/academia_licoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Lessons"
                ],
                "operationId": "obterAcademiaLicoes",
                "summary": "Get Lesson",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_licoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_licoes"
            },
            "put": {
                "tags": [
                    "Recurso: Lessons"
                ],
                "operationId": "alterarAcademiaLicoes",
                "summary": "Update Lesson",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_licoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_licoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_licoes"
            },
            "delete": {
                "tags": [
                    "Recurso: Lessons"
                ],
                "operationId": "apagarAcademiaLicoes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_licoes"
            }
        },
        "/r/academia_percursos": {
            "get": {
                "tags": [
                    "Recurso: Training paths"
                ],
                "operationId": "listarAcademiaPercursos",
                "summary": "List Training paths",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_academia_percursos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_percursos"
            },
            "post": {
                "tags": [
                    "Recurso: Training paths"
                ],
                "operationId": "criarAcademiaPercursos",
                "summary": "Create Path",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_percursos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_percursos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_percursos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_percursos"
            }
        },
        "/r/academia_percursos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Training paths"
                ],
                "operationId": "esquemaAcademiaPercursos",
                "summary": "Schema of «Training paths» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_percursos"
            }
        },
        "/r/academia_percursos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Training paths"
                ],
                "operationId": "obterAcademiaPercursos",
                "summary": "Get Path",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_percursos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_percursos"
            },
            "put": {
                "tags": [
                    "Recurso: Training paths"
                ],
                "operationId": "alterarAcademiaPercursos",
                "summary": "Update Path",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_percursos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_percursos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_percursos"
            },
            "delete": {
                "tags": [
                    "Recurso: Training paths"
                ],
                "operationId": "apagarAcademiaPercursos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_percursos"
            }
        },
        "/r/academia_perguntas": {
            "get": {
                "tags": [
                    "Recurso: Test questions"
                ],
                "operationId": "listarAcademiaPerguntas",
                "summary": "List Test questions",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[curso_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Course». List: a,b; range: f[curso_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_academia_perguntas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_perguntas"
            },
            "post": {
                "tags": [
                    "Recurso: Test questions"
                ],
                "operationId": "criarAcademiaPerguntas",
                "summary": "Create Question",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_perguntas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_perguntas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_perguntas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_perguntas"
            }
        },
        "/r/academia_perguntas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Test questions"
                ],
                "operationId": "esquemaAcademiaPerguntas",
                "summary": "Schema of «Test questions» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_perguntas"
            }
        },
        "/r/academia_perguntas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Test questions"
                ],
                "operationId": "obterAcademiaPerguntas",
                "summary": "Get Question",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_perguntas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "academia_perguntas"
            },
            "put": {
                "tags": [
                    "Recurso: Test questions"
                ],
                "operationId": "alterarAcademiaPerguntas",
                "summary": "Update Question",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_academia_perguntas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_academia_perguntas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_perguntas"
            },
            "delete": {
                "tags": [
                    "Recurso: Test questions"
                ],
                "operationId": "apagarAcademiaPerguntas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "academia_perguntas"
            }
        },
        "/r/acessos_emergencia": {
            "get": {
                "tags": [
                    "Recurso: Emergency access"
                ],
                "operationId": "listarAcessosEmergencia",
                "summary": "List Emergency access",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Requested by». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[decisao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Decision». List: a,b; range: f[decisao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_acessos_emergencia"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "acessos_emergencia"
            }
        },
        "/r/acessos_emergencia/esquema": {
            "get": {
                "tags": [
                    "Recurso: Emergency access"
                ],
                "operationId": "esquemaAcessosEmergencia",
                "summary": "Schema of «Emergency access» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "acessos_emergencia"
            }
        },
        "/r/acessos_emergencia/{id}": {
            "get": {
                "tags": [
                    "Recurso: Emergency access"
                ],
                "operationId": "obterAcessosEmergencia",
                "summary": "Get Emergency access",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_acessos_emergencia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "acessos_emergencia"
            }
        },
        "/r/acessos_emergencia/{id}/acao/rever": {
            "post": {
                "tags": [
                    "Recurso: Emergency access"
                ],
                "operationId": "acaoReverAcessosEmergencia",
                "summary": "Action: Review",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Decision",
                                        "enum": [
                                            "justificado",
                                            "injustificado"
                                        ],
                                        "x-enum-rotulos": {
                                            "justificado": "Justified",
                                            "injustificado": "Unjustified"
                                        }
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Review notes",
                                        "maxLength": 2000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "acessos_emergencia"
            }
        },
        "/r/acessos_emergencia/{id}/acao/terminar": {
            "post": {
                "tags": [
                    "Recurso: Emergency access"
                ],
                "operationId": "acaoTerminarAcessosEmergencia",
                "summary": "Action: End now",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "acessos_emergencia"
            }
        },
        "/r/agente_pedidos": {
            "get": {
                "tags": [
                    "Recurso: Agent requests"
                ],
                "operationId": "listarAgentePedidos",
                "summary": "List Agent requests",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[sinal_alarme]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Red flag». List: a,b; range: f[sinal_alarme][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[amostra]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Review sample». List: a,b; range: f[amostra][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[revisao_estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Review». List: a,b; range: f[revisao_estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[criado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[criado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_agente_pedidos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "agente_pedidos"
            }
        },
        "/r/agente_pedidos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Agent requests"
                ],
                "operationId": "esquemaAgentePedidos",
                "summary": "Schema of «Agent requests» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "agente_pedidos"
            }
        },
        "/r/agente_pedidos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Agent requests"
                ],
                "operationId": "obterAgentePedidos",
                "summary": "Get Agent request",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_agente_pedidos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "agente_pedidos"
            }
        },
        "/r/agente_pedidos/{id}/acao/teste": {
            "post": {
                "tags": [
                    "Recurso: Agent requests"
                ],
                "operationId": "acaoTesteAgentePedidos",
                "summary": "Action: Create test conversation",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "agente_pedidos"
            }
        },
        "/r/agente_testes": {
            "get": {
                "tags": [
                    "Recurso: Test conversations"
                ],
                "operationId": "listarAgenteTestes",
                "summary": "List Test conversations",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_agente_testes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "agente_testes"
            },
            "post": {
                "tags": [
                    "Recurso: Test conversations"
                ],
                "operationId": "criarAgenteTestes",
                "summary": "Create Test conversation",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_agente_testes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_agente_testes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_agente_testes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "agente_testes"
            }
        },
        "/r/agente_testes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Test conversations"
                ],
                "operationId": "esquemaAgenteTestes",
                "summary": "Schema of «Test conversations» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "agente_testes"
            }
        },
        "/r/agente_testes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Test conversations"
                ],
                "operationId": "obterAgenteTestes",
                "summary": "Get Test conversation",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_agente_testes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "agente_testes"
            },
            "put": {
                "tags": [
                    "Recurso: Test conversations"
                ],
                "operationId": "alterarAgenteTestes",
                "summary": "Update Test conversation",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_agente_testes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_agente_testes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "agente_testes"
            },
            "delete": {
                "tags": [
                    "Recurso: Test conversations"
                ],
                "operationId": "apagarAgenteTestes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "agente_testes"
            }
        },
        "/r/alertas_acesso": {
            "get": {
                "tags": [
                    "Recurso: Access alerts"
                ],
                "operationId": "listarAlertasAcesso",
                "summary": "List Access alerts",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Person». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[gravidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Severity». List: a,b; range: f[gravidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[detetado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Detected on». List: a,b; range: f[detetado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[decisao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Decision». List: a,b; range: f[decisao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_alertas_acesso"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "alertas_acesso"
            }
        },
        "/r/alertas_acesso/esquema": {
            "get": {
                "tags": [
                    "Recurso: Access alerts"
                ],
                "operationId": "esquemaAlertasAcesso",
                "summary": "Schema of «Access alerts» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "alertas_acesso"
            }
        },
        "/r/alertas_acesso/{id}": {
            "get": {
                "tags": [
                    "Recurso: Access alerts"
                ],
                "operationId": "obterAlertasAcesso",
                "summary": "Get Access alert",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_alertas_acesso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "alertas_acesso"
            }
        },
        "/r/alertas_acesso/{id}/acao/detetar_agora": {
            "post": {
                "tags": [
                    "Recurso: Access alerts"
                ],
                "operationId": "acaoDetetarAgoraAlertasAcesso",
                "summary": "Action: Detect now",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "alertas_acesso"
            }
        },
        "/r/alertas_acesso/{id}/acao/rever": {
            "post": {
                "tags": [
                    "Recurso: Access alerts"
                ],
                "operationId": "acaoReverAlertasAcesso",
                "summary": "Action: Review",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.auditoria:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Decision",
                                        "enum": [
                                            "justificado",
                                            "injustificado",
                                            "falso_positivo"
                                        ],
                                        "x-enum-rotulos": {
                                            "justificado": "Justified",
                                            "injustificado": "Unjustified",
                                            "falso_positivo": "False positive"
                                        }
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Notes",
                                        "maxLength": 5000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "alertas_acesso"
            }
        },
        "/r/api_clientes": {
            "get": {
                "tags": [
                    "Recurso: Integration clients"
                ],
                "operationId": "listarApiClientes",
                "summary": "List Integration clients",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_api_clientes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "api_clientes"
            },
            "post": {
                "tags": [
                    "Recurso: Integration clients"
                ],
                "operationId": "criarApiClientes",
                "summary": "Create Integration client",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_api_clientes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_api_clientes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_api_clientes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "api_clientes"
            }
        },
        "/r/api_clientes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Integration clients"
                ],
                "operationId": "esquemaApiClientes",
                "summary": "Schema of «Integration clients» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "api_clientes"
            }
        },
        "/r/api_clientes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Integration clients"
                ],
                "operationId": "obterApiClientes",
                "summary": "Get Integration client",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_api_clientes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "api_clientes"
            },
            "put": {
                "tags": [
                    "Recurso: Integration clients"
                ],
                "operationId": "alterarApiClientes",
                "summary": "Update Integration client",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_api_clientes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_api_clientes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "api_clientes"
            },
            "delete": {
                "tags": [
                    "Recurso: Integration clients"
                ],
                "operationId": "apagarApiClientes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "api_clientes"
            }
        },
        "/r/api_clientes/{id}/acao/aprovar_justificacao": {
            "post": {
                "tags": [
                    "Recurso: Integration clients"
                ],
                "operationId": "acaoAprovarJustificacaoApiClientes",
                "summary": "Action: Approve clinical justification",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "api_clientes"
            }
        },
        "/r/api_clientes/{id}/acao/revogar": {
            "post": {
                "tags": [
                    "Recurso: Integration clients"
                ],
                "operationId": "acaoRevogarApiClientes",
                "summary": "Action: Revoke",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "api_clientes"
            }
        },
        "/r/api_clientes/{id}/acao/rodar_segredo": {
            "post": {
                "tags": [
                    "Recurso: Integration clients"
                ],
                "operationId": "acaoRodarSegredoApiClientes",
                "summary": "Action: Rotate secret",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "api_clientes"
            }
        },
        "/r/artigos": {
            "get": {
                "tags": [
                    "Recurso: Items"
                ],
                "operationId": "listarArtigos",
                "summary": "List Items",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[categoria]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Category». List: a,b; range: f[categoria][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[fornecedor]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Usual supplier». List: a,b; range: f[fornecedor][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_artigos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "artigos"
            },
            "post": {
                "tags": [
                    "Recurso: Items"
                ],
                "operationId": "criarArtigos",
                "summary": "Create Item",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_artigos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_artigos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_artigos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "artigos"
            }
        },
        "/r/artigos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Items"
                ],
                "operationId": "esquemaArtigos",
                "summary": "Schema of «Items» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "artigos"
            }
        },
        "/r/artigos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Items"
                ],
                "operationId": "obterArtigos",
                "summary": "Get Item",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_artigos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "artigos"
            },
            "put": {
                "tags": [
                    "Recurso: Items"
                ],
                "operationId": "alterarArtigos",
                "summary": "Update Item",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_artigos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_artigos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "artigos"
            },
            "delete": {
                "tags": [
                    "Recurso: Items"
                ],
                "operationId": "apagarArtigos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "artigos"
            }
        },
        "/r/artigos/{id}/acao/movimento": {
            "post": {
                "tags": [
                    "Recurso: Items"
                ],
                "operationId": "acaoMovimentoArtigos",
                "summary": "Action: Record movement",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tipo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Type",
                                        "enum": [
                                            "entrada",
                                            "saida",
                                            "ajuste",
                                            "devolucao"
                                        ],
                                        "x-enum-rotulos": {
                                            "entrada": "Stock in",
                                            "saida": "Stock out",
                                            "ajuste": "Adjustment",
                                            "devolucao": "Return"
                                        }
                                    },
                                    "quantidade": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "title": "Quantity",
                                        "description": "Positive for stock in; for adjustments, negative to remove.",
                                        "x-casas": 3
                                    },
                                    "lote": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Batch",
                                        "maxLength": 60
                                    },
                                    "validade": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "title": "Expiry date"
                                    },
                                    "custo": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "title": "Unit cost",
                                        "minimum": 0,
                                        "x-moeda": "EUR",
                                        "x-casas": 4
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Notes",
                                        "maxLength": 500
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "artigos"
            }
        },
        "/r/artigos_precos": {
            "get": {
                "tags": [
                    "Recurso: Supplier prices"
                ],
                "operationId": "listarArtigosPrecos",
                "summary": "List Supplier prices",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[artigo_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Item». List: a,b; range: f[artigo_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[fornecedor]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Supplier». List: a,b; range: f[fornecedor][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[preferido]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Preferred». List: a,b; range: f[preferido][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_artigos_precos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "artigos_precos"
            },
            "post": {
                "tags": [
                    "Recurso: Supplier prices"
                ],
                "operationId": "criarArtigosPrecos",
                "summary": "Create Supplier price",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_artigos_precos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_artigos_precos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_artigos_precos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "artigos_precos"
            }
        },
        "/r/artigos_precos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Supplier prices"
                ],
                "operationId": "esquemaArtigosPrecos",
                "summary": "Schema of «Supplier prices» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "artigos_precos"
            }
        },
        "/r/artigos_precos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Supplier prices"
                ],
                "operationId": "obterArtigosPrecos",
                "summary": "Get Supplier price",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_artigos_precos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "artigos_precos"
            },
            "put": {
                "tags": [
                    "Recurso: Supplier prices"
                ],
                "operationId": "alterarArtigosPrecos",
                "summary": "Update Supplier price",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_artigos_precos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_artigos_precos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "artigos_precos"
            },
            "delete": {
                "tags": [
                    "Recurso: Supplier prices"
                ],
                "operationId": "apagarArtigosPrecos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "artigos_precos"
            }
        },
        "/r/atividades_tratamento": {
            "get": {
                "tags": [
                    "Recurso: Record of processing activities"
                ],
                "operationId": "listarAtividadesTratamento",
                "summary": "List Record of processing activities",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[base_legal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Legal basis». List: a,b; range: f[base_legal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[aipd_estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Impact assessment». List: a,b; range: f[aipd_estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[dispositivo_medico]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Software as a medical device». List: a,b; range: f[dispositivo_medico][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_atividades_tratamento"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "atividades_tratamento"
            },
            "post": {
                "tags": [
                    "Recurso: Record of processing activities"
                ],
                "operationId": "criarAtividadesTratamento",
                "summary": "Create Processing activity",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_atividades_tratamento_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_atividades_tratamento_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_atividades_tratamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "atividades_tratamento"
            }
        },
        "/r/atividades_tratamento/esquema": {
            "get": {
                "tags": [
                    "Recurso: Record of processing activities"
                ],
                "operationId": "esquemaAtividadesTratamento",
                "summary": "Schema of «Record of processing activities» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "atividades_tratamento"
            }
        },
        "/r/atividades_tratamento/{id}": {
            "get": {
                "tags": [
                    "Recurso: Record of processing activities"
                ],
                "operationId": "obterAtividadesTratamento",
                "summary": "Get Processing activity",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_atividades_tratamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "atividades_tratamento"
            },
            "put": {
                "tags": [
                    "Recurso: Record of processing activities"
                ],
                "operationId": "alterarAtividadesTratamento",
                "summary": "Update Processing activity",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_atividades_tratamento_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_atividades_tratamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "atividades_tratamento"
            },
            "delete": {
                "tags": [
                    "Recurso: Record of processing activities"
                ],
                "operationId": "apagarAtividadesTratamento",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "atividades_tratamento"
            }
        },
        "/r/atividades_tratamento/{id}/acao/marcar_revista": {
            "post": {
                "tags": [
                    "Recurso: Record of processing activities"
                ],
                "operationId": "acaoMarcarRevistaAtividadesTratamento",
                "summary": "Action: Mark as reviewed",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "atividades_tratamento"
            }
        },
        "/r/ausencias": {
            "get": {
                "tags": [
                    "Recurso: Absences and holidays"
                ],
                "operationId": "listarAusencias",
                "summary": "List Absences and holidays",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Person». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[recurso_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Room or equipment». List: a,b; range: f[recurso_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[inicio]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Start». List: a,b; range: f[inicio][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[aprovada]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Approved». List: a,b; range: f[aprovada][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_ausencias"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ausencias"
            },
            "post": {
                "tags": [
                    "Recurso: Absences and holidays"
                ],
                "operationId": "criarAusencias",
                "summary": "Create Absence",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_ausencias_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_ausencias_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_ausencias"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "ausencias"
            }
        },
        "/r/ausencias/esquema": {
            "get": {
                "tags": [
                    "Recurso: Absences and holidays"
                ],
                "operationId": "esquemaAusencias",
                "summary": "Schema of «Absences and holidays» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ausencias"
            }
        },
        "/r/ausencias/{id}": {
            "get": {
                "tags": [
                    "Recurso: Absences and holidays"
                ],
                "operationId": "obterAusencias",
                "summary": "Get Absence",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_ausencias"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ausencias"
            },
            "put": {
                "tags": [
                    "Recurso: Absences and holidays"
                ],
                "operationId": "alterarAusencias",
                "summary": "Update Absence",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_ausencias_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_ausencias"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "ausencias"
            },
            "delete": {
                "tags": [
                    "Recurso: Absences and holidays"
                ],
                "operationId": "apagarAusencias",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "ausencias"
            }
        },
        "/r/avisos_exibicoes": {
            "get": {
                "tags": [
                    "Recurso: Notices shown"
                ],
                "operationId": "listarAvisosExibicoes",
                "summary": "List Notices shown",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[mostrado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Shown on». List: a,b; range: f[mostrado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[aviso_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Notice». List: a,b; range: f[aviso_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[contexto]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Where». List: a,b; range: f[contexto][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[meio]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Medium». List: a,b; range: f[meio][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[prova]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Evidence». List: a,b; range: f[prova][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[titular_tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Data subject». List: a,b; range: f[titular_tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[lead_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Contact». List: a,b; range: f[lead_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_avisos_exibicoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "avisos_exibicoes"
            }
        },
        "/r/avisos_exibicoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Notices shown"
                ],
                "operationId": "esquemaAvisosExibicoes",
                "summary": "Schema of «Notices shown» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "avisos_exibicoes"
            }
        },
        "/r/avisos_exibicoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Notices shown"
                ],
                "operationId": "obterAvisosExibicoes",
                "summary": "Get Notice shown",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_avisos_exibicoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "avisos_exibicoes"
            }
        },
        "/r/avisos_privacidade": {
            "get": {
                "tags": [
                    "Recurso: Privacy notices"
                ],
                "operationId": "listarAvisosPrivacidade",
                "summary": "List Privacy notices",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «In force». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_avisos_privacidade"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "avisos_privacidade"
            },
            "post": {
                "tags": [
                    "Recurso: Privacy notices"
                ],
                "operationId": "criarAvisosPrivacidade",
                "summary": "Create Privacy notice",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_avisos_privacidade_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_avisos_privacidade_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_avisos_privacidade"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "avisos_privacidade"
            }
        },
        "/r/avisos_privacidade/esquema": {
            "get": {
                "tags": [
                    "Recurso: Privacy notices"
                ],
                "operationId": "esquemaAvisosPrivacidade",
                "summary": "Schema of «Privacy notices» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "avisos_privacidade"
            }
        },
        "/r/avisos_privacidade/{id}": {
            "get": {
                "tags": [
                    "Recurso: Privacy notices"
                ],
                "operationId": "obterAvisosPrivacidade",
                "summary": "Get Privacy notice",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_avisos_privacidade"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "avisos_privacidade"
            },
            "put": {
                "tags": [
                    "Recurso: Privacy notices"
                ],
                "operationId": "alterarAvisosPrivacidade",
                "summary": "Update Privacy notice",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_avisos_privacidade_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_avisos_privacidade"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "avisos_privacidade"
            },
            "delete": {
                "tags": [
                    "Recurso: Privacy notices"
                ],
                "operationId": "apagarAvisosPrivacidade",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "avisos_privacidade"
            }
        },
        "/r/avisos_privacidade/{id}/acao/nova_versao": {
            "post": {
                "tags": [
                    "Recurso: Privacy notices"
                ],
                "operationId": "acaoNovaVersaoAvisosPrivacidade",
                "summary": "Action: New version",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "avisos_privacidade"
            }
        },
        "/r/avisos_privacidade/{id}/acao/publicar": {
            "post": {
                "tags": [
                    "Recurso: Privacy notices"
                ],
                "operationId": "acaoPublicarAvisosPrivacidade",
                "summary": "Action: Publish",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "avisos_privacidade"
            }
        },
        "/r/base_conhecimento": {
            "get": {
                "tags": [
                    "Recurso: Knowledge base"
                ],
                "operationId": "listarBaseConhecimento",
                "summary": "List Knowledge base",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[categoria]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Category». List: a,b; range: f[categoria][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[publico]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «For». List: a,b; range: f[publico][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[clinico]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Clinical content». List: a,b; range: f[clinico][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_base_conhecimento"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "base_conhecimento"
            },
            "post": {
                "tags": [
                    "Recurso: Knowledge base"
                ],
                "operationId": "criarBaseConhecimento",
                "summary": "Create Article",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_base_conhecimento_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_base_conhecimento_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_base_conhecimento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "base_conhecimento"
            }
        },
        "/r/base_conhecimento/esquema": {
            "get": {
                "tags": [
                    "Recurso: Knowledge base"
                ],
                "operationId": "esquemaBaseConhecimento",
                "summary": "Schema of «Knowledge base» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "base_conhecimento"
            }
        },
        "/r/base_conhecimento/{id}": {
            "get": {
                "tags": [
                    "Recurso: Knowledge base"
                ],
                "operationId": "obterBaseConhecimento",
                "summary": "Get Article",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_base_conhecimento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "base_conhecimento"
            },
            "put": {
                "tags": [
                    "Recurso: Knowledge base"
                ],
                "operationId": "alterarBaseConhecimento",
                "summary": "Update Article",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_base_conhecimento_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_base_conhecimento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "base_conhecimento"
            },
            "delete": {
                "tags": [
                    "Recurso: Knowledge base"
                ],
                "operationId": "apagarBaseConhecimento",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "base_conhecimento"
            }
        },
        "/r/base_conhecimento/{id}/acao/aprovar": {
            "post": {
                "tags": [
                    "Recurso: Knowledge base"
                ],
                "operationId": "acaoAprovarBaseConhecimento",
                "summary": "Action: Approve",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "base_conhecimento"
            }
        },
        "/r/base_conhecimento/{id}/acao/arquivar": {
            "post": {
                "tags": [
                    "Recurso: Knowledge base"
                ],
                "operationId": "acaoArquivarBaseConhecimento",
                "summary": "Action: Archive",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.agente:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "base_conhecimento"
            }
        },
        "/r/caixas": {
            "get": {
                "tags": [
                    "Recurso: Tills"
                ],
                "operationId": "listarCaixas",
                "summary": "List Tills",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[data]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[data][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[local_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Location». List: a,b; range: f[local_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_caixas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "caixas"
            }
        },
        "/r/caixas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Tills"
                ],
                "operationId": "esquemaCaixas",
                "summary": "Schema of «Tills» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "caixas"
            }
        },
        "/r/caixas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Tills"
                ],
                "operationId": "obterCaixas",
                "summary": "Get Till",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_caixas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "caixas"
            }
        },
        "/r/campanhas": {
            "get": {
                "tags": [
                    "Recurso: Campaigns"
                ],
                "operationId": "listarCampanhas",
                "summary": "List Campaigns",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_campanhas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "campanhas"
            },
            "post": {
                "tags": [
                    "Recurso: Campaigns"
                ],
                "operationId": "criarCampanhas",
                "summary": "Create Campaign",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_campanhas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_campanhas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_campanhas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "campanhas"
            }
        },
        "/r/campanhas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Campaigns"
                ],
                "operationId": "esquemaCampanhas",
                "summary": "Schema of «Campaigns» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "campanhas"
            }
        },
        "/r/campanhas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Campaigns"
                ],
                "operationId": "obterCampanhas",
                "summary": "Get Campaign",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_campanhas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "campanhas"
            },
            "put": {
                "tags": [
                    "Recurso: Campaigns"
                ],
                "operationId": "alterarCampanhas",
                "summary": "Update Campaign",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_campanhas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_campanhas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "campanhas"
            },
            "delete": {
                "tags": [
                    "Recurso: Campaigns"
                ],
                "operationId": "apagarCampanhas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "campanhas"
            }
        },
        "/r/campanhas_chamadas": {
            "get": {
                "tags": [
                    "Recurso: Call lists"
                ],
                "operationId": "listarCampanhasChamadas",
                "summary": "List Call lists",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[executor]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Who calls». List: a,b; range: f[executor][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_campanhas_chamadas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "campanhas_chamadas"
            },
            "post": {
                "tags": [
                    "Recurso: Call lists"
                ],
                "operationId": "criarCampanhasChamadas",
                "summary": "Create Call list",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_campanhas_chamadas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_campanhas_chamadas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_campanhas_chamadas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "campanhas_chamadas"
            }
        },
        "/r/campanhas_chamadas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Call lists"
                ],
                "operationId": "esquemaCampanhasChamadas",
                "summary": "Schema of «Call lists» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "campanhas_chamadas"
            }
        },
        "/r/campanhas_chamadas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Call lists"
                ],
                "operationId": "obterCampanhasChamadas",
                "summary": "Get Call list",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_campanhas_chamadas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "campanhas_chamadas"
            },
            "put": {
                "tags": [
                    "Recurso: Call lists"
                ],
                "operationId": "alterarCampanhasChamadas",
                "summary": "Update Call list",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_campanhas_chamadas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_campanhas_chamadas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "campanhas_chamadas"
            },
            "delete": {
                "tags": [
                    "Recurso: Call lists"
                ],
                "operationId": "apagarCampanhasChamadas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "campanhas_chamadas"
            }
        },
        "/r/campanhas_chamadas/{id}/acao/ativar": {
            "post": {
                "tags": [
                    "Recurso: Call lists"
                ],
                "operationId": "acaoAtivarCampanhasChamadas",
                "summary": "Action: Activate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "campanhas_chamadas"
            }
        },
        "/r/campanhas_chamadas/{id}/acao/gerar": {
            "post": {
                "tags": [
                    "Recurso: Call lists"
                ],
                "operationId": "acaoGerarCampanhasChamadas",
                "summary": "Action: Generate contacts",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "campanhas_chamadas"
            }
        },
        "/r/campanhas_chamadas/{id}/acao/pausar": {
            "post": {
                "tags": [
                    "Recurso: Call lists"
                ],
                "operationId": "acaoPausarCampanhasChamadas",
                "summary": "Action: Pause",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "campanhas_chamadas"
            }
        },
        "/r/capturas": {
            "get": {
                "tags": [
                    "Recurso: Captures"
                ],
                "operationId": "listarCapturas",
                "summary": "List Captures",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[data]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[data][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[qualidade_ok]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Sufficient quality». List: a,b; range: f[qualidade_ok][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[repetir]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Retake». List: a,b; range: f[repetir][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_capturas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "capturas"
            },
            "post": {
                "tags": [
                    "Recurso: Captures"
                ],
                "operationId": "criarCapturas",
                "summary": "Create Capture",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_capturas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_capturas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_capturas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "capturas"
            }
        },
        "/r/capturas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Captures"
                ],
                "operationId": "esquemaCapturas",
                "summary": "Schema of «Captures» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "capturas"
            }
        },
        "/r/capturas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Captures"
                ],
                "operationId": "obterCapturas",
                "summary": "Get Capture",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_capturas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "capturas"
            },
            "put": {
                "tags": [
                    "Recurso: Captures"
                ],
                "operationId": "alterarCapturas",
                "summary": "Update Capture",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_capturas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_capturas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "capturas"
            },
            "delete": {
                "tags": [
                    "Recurso: Captures"
                ],
                "operationId": "apagarCapturas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "capturas"
            }
        },
        "/r/capturas/{id}/acao/pedir_repeticao": {
            "post": {
                "tags": [
                    "Recurso: Captures"
                ],
                "operationId": "acaoPedirRepeticaoCapturas",
                "summary": "Action: Request retake",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason for retake",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "capturas"
            }
        },
        "/r/casos_publicados": {
            "get": {
                "tags": [
                    "Recurso: Published cases"
                ],
                "operationId": "listarCasosPublicados",
                "summary": "List Published cases",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[publicado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Published». List: a,b; range: f[publicado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_casos_publicados"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "casos_publicados"
            },
            "post": {
                "tags": [
                    "Recurso: Published cases"
                ],
                "operationId": "criarCasosPublicados",
                "summary": "Create Case",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_casos_publicados_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_casos_publicados_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_casos_publicados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "casos_publicados"
            }
        },
        "/r/casos_publicados/esquema": {
            "get": {
                "tags": [
                    "Recurso: Published cases"
                ],
                "operationId": "esquemaCasosPublicados",
                "summary": "Schema of «Published cases» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "casos_publicados"
            }
        },
        "/r/casos_publicados/{id}": {
            "get": {
                "tags": [
                    "Recurso: Published cases"
                ],
                "operationId": "obterCasosPublicados",
                "summary": "Get Case",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_casos_publicados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "casos_publicados"
            },
            "put": {
                "tags": [
                    "Recurso: Published cases"
                ],
                "operationId": "alterarCasosPublicados",
                "summary": "Update Case",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_casos_publicados_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_casos_publicados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "casos_publicados"
            },
            "delete": {
                "tags": [
                    "Recurso: Published cases"
                ],
                "operationId": "apagarCasosPublicados",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "casos_publicados"
            }
        },
        "/r/chamadas": {
            "get": {
                "tags": [
                    "Recurso: Calls"
                ],
                "operationId": "listarChamadas",
                "summary": "List Calls",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[direcao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Direction». List: a,b; range: f[direcao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[inicio]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Start». List: a,b; range: f[inicio][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Handled by». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[resultado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Outcome». List: a,b; range: f[resultado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_chamadas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "chamadas"
            },
            "post": {
                "tags": [
                    "Recurso: Calls"
                ],
                "operationId": "criarChamadas",
                "summary": "Create Call",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_chamadas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_chamadas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_chamadas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "chamadas"
            }
        },
        "/r/chamadas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Calls"
                ],
                "operationId": "esquemaChamadas",
                "summary": "Schema of «Calls» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "chamadas"
            }
        },
        "/r/chamadas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Calls"
                ],
                "operationId": "obterChamadas",
                "summary": "Get Call",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_chamadas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "chamadas"
            },
            "put": {
                "tags": [
                    "Recurso: Calls"
                ],
                "operationId": "alterarChamadas",
                "summary": "Update Call",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_chamadas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_chamadas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "chamadas"
            }
        },
        "/r/checklist_modelos": {
            "get": {
                "tags": [
                    "Recurso: Safety checklists"
                ],
                "operationId": "listarChecklistModelos",
                "summary": "List Safety checklists",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.registo:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[fase]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Phase». List: a,b; range: f[fase][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_checklist_modelos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "checklist_modelos"
            },
            "post": {
                "tags": [
                    "Recurso: Safety checklists"
                ],
                "operationId": "criarChecklistModelos",
                "summary": "Create Checklist template",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.registo:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_checklist_modelos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_checklist_modelos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_checklist_modelos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "checklist_modelos"
            }
        },
        "/r/checklist_modelos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Safety checklists"
                ],
                "operationId": "esquemaChecklistModelos",
                "summary": "Schema of «Safety checklists» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.registo:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "checklist_modelos"
            }
        },
        "/r/checklist_modelos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Safety checklists"
                ],
                "operationId": "obterChecklistModelos",
                "summary": "Get Checklist template",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.registo:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_checklist_modelos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "checklist_modelos"
            },
            "put": {
                "tags": [
                    "Recurso: Safety checklists"
                ],
                "operationId": "alterarChecklistModelos",
                "summary": "Update Checklist template",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.registo:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_checklist_modelos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_checklist_modelos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "checklist_modelos"
            },
            "delete": {
                "tags": [
                    "Recurso: Safety checklists"
                ],
                "operationId": "apagarChecklistModelos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.registo:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "checklist_modelos"
            }
        },
        "/r/cirurgias": {
            "get": {
                "tags": [
                    "Recurso: Surgeries"
                ],
                "operationId": "listarCirurgias",
                "summary": "List Surgeries",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.mapa:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[inicio_previsto]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Planned date». List: a,b; range: f[inicio_previsto][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[sala_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Room». List: a,b; range: f[sala_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tecnica]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Technique». List: a,b; range: f[tecnica][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[aptidao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Fitness». List: a,b; range: f[aptidao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_cirurgias"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "bloco.mapa",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cirurgias"
            }
        },
        "/r/cirurgias/esquema": {
            "get": {
                "tags": [
                    "Recurso: Surgeries"
                ],
                "operationId": "esquemaCirurgias",
                "summary": "Schema of «Surgeries» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.mapa:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "bloco.mapa",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cirurgias"
            }
        },
        "/r/cirurgias/{id}": {
            "get": {
                "tags": [
                    "Recurso: Surgeries"
                ],
                "operationId": "obterCirurgias",
                "summary": "Get Surgery",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "bloco.mapa:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_cirurgias"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "bloco.mapa",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cirurgias"
            }
        },
        "/r/clinicas": {
            "get": {
                "tags": [
                    "Recurso: Clinics"
                ],
                "operationId": "listarClinicas",
                "summary": "List Clinics",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_clinicas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "clinicas"
            },
            "post": {
                "tags": [
                    "Recurso: Clinics"
                ],
                "operationId": "criarClinicas",
                "summary": "Create Clinic",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_clinicas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_clinicas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_clinicas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "clinicas"
            }
        },
        "/r/clinicas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Clinics"
                ],
                "operationId": "esquemaClinicas",
                "summary": "Schema of «Clinics» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "clinicas"
            }
        },
        "/r/clinicas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Clinics"
                ],
                "operationId": "obterClinicas",
                "summary": "Get Clinic",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_clinicas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "clinicas"
            },
            "put": {
                "tags": [
                    "Recurso: Clinics"
                ],
                "operationId": "alterarClinicas",
                "summary": "Update Clinic",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_clinicas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_clinicas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "clinicas"
            }
        },
        "/r/cms_blocos": {
            "get": {
                "tags": [
                    "Recurso: Website blocks"
                ],
                "operationId": "listarCmsBlocos",
                "summary": "List Website blocks",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[pagina]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Page». List: a,b; range: f[pagina][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_cms_blocos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cms_blocos"
            }
        },
        "/r/cms_blocos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Website blocks"
                ],
                "operationId": "esquemaCmsBlocos",
                "summary": "Schema of «Website blocks» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cms_blocos"
            }
        },
        "/r/cms_blocos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Website blocks"
                ],
                "operationId": "obterCmsBlocos",
                "summary": "Get Block",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_cms_blocos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cms_blocos"
            },
            "put": {
                "tags": [
                    "Recurso: Website blocks"
                ],
                "operationId": "alterarCmsBlocos",
                "summary": "Update Block",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_cms_blocos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_cms_blocos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cms_blocos"
            }
        },
        "/r/cms_paginas": {
            "get": {
                "tags": [
                    "Recurso: Website pages"
                ],
                "operationId": "listarCmsPaginas",
                "summary": "List Website pages",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[publicada]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Published». List: a,b; range: f[publicada][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_cms_paginas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cms_paginas"
            },
            "post": {
                "tags": [
                    "Recurso: Website pages"
                ],
                "operationId": "criarCmsPaginas",
                "summary": "Create Page",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_cms_paginas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_cms_paginas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_cms_paginas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cms_paginas"
            }
        },
        "/r/cms_paginas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Website pages"
                ],
                "operationId": "esquemaCmsPaginas",
                "summary": "Schema of «Website pages» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cms_paginas"
            }
        },
        "/r/cms_paginas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Website pages"
                ],
                "operationId": "obterCmsPaginas",
                "summary": "Get Page",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_cms_paginas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cms_paginas"
            },
            "put": {
                "tags": [
                    "Recurso: Website pages"
                ],
                "operationId": "alterarCmsPaginas",
                "summary": "Update Page",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_cms_paginas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_cms_paginas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cms_paginas"
            },
            "delete": {
                "tags": [
                    "Recurso: Website pages"
                ],
                "operationId": "apagarCmsPaginas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cms_paginas"
            }
        },
        "/r/cms_paginas/{id}/acao/despublicar": {
            "post": {
                "tags": [
                    "Recurso: Website pages"
                ],
                "operationId": "acaoDespublicarCmsPaginas",
                "summary": "Action: Unpublish",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cms_paginas"
            }
        },
        "/r/cms_paginas/{id}/acao/previsualizar": {
            "post": {
                "tags": [
                    "Recurso: Website pages"
                ],
                "operationId": "acaoPrevisualizarCmsPaginas",
                "summary": "Action: Preview",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "cms_paginas"
            }
        },
        "/r/cms_paginas/{id}/acao/publicar": {
            "post": {
                "tags": [
                    "Recurso: Website pages"
                ],
                "operationId": "acaoPublicarCmsPaginas",
                "summary": "Action: Publish",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "site.cms:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason for the change",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cms_paginas"
            }
        },
        "/r/codigos_desconto": {
            "get": {
                "tags": [
                    "Recurso: Discount codes"
                ],
                "operationId": "listarCodigosDesconto",
                "summary": "List Discount codes",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.descontos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[valido_ate]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Valid until». List: a,b; range: f[valido_ate][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_codigos_desconto"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.descontos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "codigos_desconto"
            },
            "post": {
                "tags": [
                    "Recurso: Discount codes"
                ],
                "operationId": "criarCodigosDesconto",
                "summary": "Create Discount code",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.descontos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_codigos_desconto_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_codigos_desconto_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_codigos_desconto"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.descontos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "codigos_desconto"
            }
        },
        "/r/codigos_desconto/esquema": {
            "get": {
                "tags": [
                    "Recurso: Discount codes"
                ],
                "operationId": "esquemaCodigosDesconto",
                "summary": "Schema of «Discount codes» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.descontos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.descontos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "codigos_desconto"
            }
        },
        "/r/codigos_desconto/{id}": {
            "get": {
                "tags": [
                    "Recurso: Discount codes"
                ],
                "operationId": "obterCodigosDesconto",
                "summary": "Get Discount code",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.descontos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_codigos_desconto"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.descontos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "codigos_desconto"
            },
            "put": {
                "tags": [
                    "Recurso: Discount codes"
                ],
                "operationId": "alterarCodigosDesconto",
                "summary": "Update Discount code",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.descontos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_codigos_desconto_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_codigos_desconto"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.descontos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "codigos_desconto"
            },
            "delete": {
                "tags": [
                    "Recurso: Discount codes"
                ],
                "operationId": "apagarCodigosDesconto",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.descontos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.descontos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "codigos_desconto"
            }
        },
        "/r/comissoes": {
            "get": {
                "tags": [
                    "Recurso: Commissions"
                ],
                "operationId": "listarComissoes",
                "summary": "List Commissions",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Person». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[proposta_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Proposal». List: a,b; range: f[proposta_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[vence_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Due on». List: a,b; range: f[vence_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[paga_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Paid on». List: a,b; range: f[paga_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_comissoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comissoes"
            },
            "post": {
                "tags": [
                    "Recurso: Commissions"
                ],
                "operationId": "criarComissoes",
                "summary": "Create Commission",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_comissoes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_comissoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_comissoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "comissoes"
            }
        },
        "/r/comissoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Commissions"
                ],
                "operationId": "esquemaComissoes",
                "summary": "Schema of «Commissions» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comissoes"
            }
        },
        "/r/comissoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Commissions"
                ],
                "operationId": "obterComissoes",
                "summary": "Get Commission",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_comissoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comissoes"
            },
            "put": {
                "tags": [
                    "Recurso: Commissions"
                ],
                "operationId": "alterarComissoes",
                "summary": "Update Commission",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_comissoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_comissoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "comissoes"
            }
        },
        "/r/comissoes/{id}/acao/estornar": {
            "post": {
                "tags": [
                    "Recurso: Commissions"
                ],
                "operationId": "acaoEstornarComissoes",
                "summary": "Action: Reverse",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reversal reason",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "comissoes"
            }
        },
        "/r/comissoes/{id}/acao/marcar_paga": {
            "post": {
                "tags": [
                    "Recurso: Commissions"
                ],
                "operationId": "acaoMarcarPagaComissoes",
                "summary": "Action: Mark as paid",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "referencia": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Payment reference",
                                        "maxLength": 80
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "comissoes"
            }
        },
        "/r/comissoes_regras": {
            "get": {
                "tags": [
                    "Recurso: Commission rules"
                ],
                "operationId": "listarComissoesRegras",
                "summary": "List Commission rules",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Person». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_comissoes_regras"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comissoes_regras"
            },
            "post": {
                "tags": [
                    "Recurso: Commission rules"
                ],
                "operationId": "criarComissoesRegras",
                "summary": "Create Commission rule",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_comissoes_regras_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_comissoes_regras_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_comissoes_regras"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "comissoes_regras"
            }
        },
        "/r/comissoes_regras/esquema": {
            "get": {
                "tags": [
                    "Recurso: Commission rules"
                ],
                "operationId": "esquemaComissoesRegras",
                "summary": "Schema of «Commission rules» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comissoes_regras"
            }
        },
        "/r/comissoes_regras/{id}": {
            "get": {
                "tags": [
                    "Recurso: Commission rules"
                ],
                "operationId": "obterComissoesRegras",
                "summary": "Get Commission rule",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_comissoes_regras"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comissoes_regras"
            },
            "put": {
                "tags": [
                    "Recurso: Commission rules"
                ],
                "operationId": "alterarComissoesRegras",
                "summary": "Update Commission rule",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_comissoes_regras_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_comissoes_regras"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "comissoes_regras"
            },
            "delete": {
                "tags": [
                    "Recurso: Commission rules"
                ],
                "operationId": "apagarComissoesRegras",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "comissoes_regras"
            }
        },
        "/r/complicacoes": {
            "get": {
                "tags": [
                    "Recurso: Complications"
                ],
                "operationId": "listarComplicacoes",
                "summary": "List Complications",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[episodio_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Episode». List: a,b; range: f[episodio_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[gravidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Severity». List: a,b; range: f[gravidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[data]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[data][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[recall]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Recall the patient». List: a,b; range: f[recall][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[recall_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Recall date». List: a,b; range: f[recall_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_complicacoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "complicacoes"
            },
            "post": {
                "tags": [
                    "Recurso: Complications"
                ],
                "operationId": "criarComplicacoes",
                "summary": "Create Complication",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_complicacoes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_complicacoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_complicacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "complicacoes"
            }
        },
        "/r/complicacoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Complications"
                ],
                "operationId": "esquemaComplicacoes",
                "summary": "Schema of «Complications» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "complicacoes"
            }
        },
        "/r/complicacoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Complications"
                ],
                "operationId": "obterComplicacoes",
                "summary": "Get Complication",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_complicacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "complicacoes"
            },
            "put": {
                "tags": [
                    "Recurso: Complications"
                ],
                "operationId": "alterarComplicacoes",
                "summary": "Update Complication",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_complicacoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_complicacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "complicacoes"
            }
        },
        "/r/complicacoes/{id}/acao/reabrir": {
            "post": {
                "tags": [
                    "Recurso: Complications"
                ],
                "operationId": "acaoReabrirComplicacoes",
                "summary": "Action: Reopen",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "complicacoes"
            }
        },
        "/r/complicacoes/{id}/acao/resolver": {
            "post": {
                "tags": [
                    "Recurso: Complications"
                ],
                "operationId": "acaoResolverComplicacoes",
                "summary": "Action: Mark as resolved",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "complicacoes"
            }
        },
        "/r/comunicados": {
            "get": {
                "tags": [
                    "Recurso: Announcements"
                ],
                "operationId": "listarComunicados",
                "summary": "List Announcements",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[publico]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Audience». List: a,b; range: f[publico][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[publicado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Publish on». List: a,b; range: f[publicado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_comunicados"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comunicados"
            },
            "post": {
                "tags": [
                    "Recurso: Announcements"
                ],
                "operationId": "criarComunicados",
                "summary": "Create Announcement",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_comunicados_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_comunicados_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_comunicados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "comunicados"
            }
        },
        "/r/comunicados/esquema": {
            "get": {
                "tags": [
                    "Recurso: Announcements"
                ],
                "operationId": "esquemaComunicados",
                "summary": "Schema of «Announcements» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comunicados"
            }
        },
        "/r/comunicados/{id}": {
            "get": {
                "tags": [
                    "Recurso: Announcements"
                ],
                "operationId": "obterComunicados",
                "summary": "Get Announcement",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_comunicados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "comunicados"
            },
            "put": {
                "tags": [
                    "Recurso: Announcements"
                ],
                "operationId": "alterarComunicados",
                "summary": "Update Announcement",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_comunicados_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_comunicados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "comunicados"
            },
            "delete": {
                "tags": [
                    "Recurso: Announcements"
                ],
                "operationId": "apagarComunicados",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "comunicados"
            }
        },
        "/r/comunicados/{id}/acao/confirmar": {
            "post": {
                "tags": [
                    "Recurso: Announcements"
                ],
                "operationId": "acaoConfirmarComunicados",
                "summary": "Action: I have read and understood",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "comunicados"
            }
        },
        "/r/comunicados/{id}/acao/lembrar": {
            "post": {
                "tags": [
                    "Recurso: Announcements"
                ],
                "operationId": "acaoLembrarComunicados",
                "summary": "Action: Remind those who have not read it",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "comunicados"
            }
        },
        "/r/consentimento_modelos": {
            "get": {
                "tags": [
                    "Recurso: Consent templates"
                ],
                "operationId": "listarConsentimentoModelos",
                "summary": "List Consent templates",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[finalidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Purpose». List: a,b; range: f[finalidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[base_legal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Legal basis». List: a,b; range: f[base_legal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tecnica]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Technique». List: a,b; range: f[tecnica][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_consentimento_modelos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consentimento_modelos"
            },
            "post": {
                "tags": [
                    "Recurso: Consent templates"
                ],
                "operationId": "criarConsentimentoModelos",
                "summary": "Create Consent template",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_consentimento_modelos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_consentimento_modelos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_consentimento_modelos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "consentimento_modelos"
            }
        },
        "/r/consentimento_modelos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Consent templates"
                ],
                "operationId": "esquemaConsentimentoModelos",
                "summary": "Schema of «Consent templates» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consentimento_modelos"
            }
        },
        "/r/consentimento_modelos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Consent templates"
                ],
                "operationId": "obterConsentimentoModelos",
                "summary": "Get Consent template",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_consentimento_modelos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consentimento_modelos"
            },
            "put": {
                "tags": [
                    "Recurso: Consent templates"
                ],
                "operationId": "alterarConsentimentoModelos",
                "summary": "Update Consent template",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_consentimento_modelos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_consentimento_modelos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "consentimento_modelos"
            },
            "delete": {
                "tags": [
                    "Recurso: Consent templates"
                ],
                "operationId": "apagarConsentimentoModelos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "consentimento_modelos"
            }
        },
        "/r/consentimento_modelos/{id}/acao/aprovar": {
            "post": {
                "tags": [
                    "Recurso: Consent templates"
                ],
                "operationId": "acaoAprovarConsentimentoModelos",
                "summary": "Action: Approve",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "consentimento_modelos"
            }
        },
        "/r/consentimento_modelos/{id}/acao/arquivar": {
            "post": {
                "tags": [
                    "Recurso: Consent templates"
                ],
                "operationId": "acaoArquivarConsentimentoModelos",
                "summary": "Action: Archive",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "consentimento_modelos"
            }
        },
        "/r/consentimento_modelos/{id}/acao/nova_versao": {
            "post": {
                "tags": [
                    "Recurso: Consent templates"
                ],
                "operationId": "acaoNovaVersaoConsentimentoModelos",
                "summary": "Action: New version",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "consentimento_modelos"
            }
        },
        "/r/consentimentos": {
            "get": {
                "tags": [
                    "Recurso: Consent register"
                ],
                "operationId": "listarConsentimentos",
                "summary": "List Consent register",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[finalidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Purpose». List: a,b; range: f[finalidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[decisao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Decision». List: a,b; range: f[decisao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[modelo_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Template». List: a,b; range: f[modelo_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[episodio_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Episode». List: a,b; range: f[episodio_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[recolhido_por]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Collected by». List: a,b; range: f[recolhido_por][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[criado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Recorded on». List: a,b; range: f[criado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_consentimentos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consentimentos"
            }
        },
        "/r/consentimentos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Consent register"
                ],
                "operationId": "esquemaConsentimentos",
                "summary": "Schema of «Consent register» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consentimentos"
            }
        },
        "/r/consentimentos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Consent register"
                ],
                "operationId": "obterConsentimentos",
                "summary": "Get Consent",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_consentimentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consentimentos"
            }
        },
        "/r/consentimentos/{id}/acao/exportar_prova": {
            "post": {
                "tags": [
                    "Recurso: Consent register"
                ],
                "operationId": "acaoExportarProvaConsentimentos",
                "summary": "Action: Export evidence",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "consentimentos"
            }
        },
        "/r/consentimentos/{id}/acao/revogar": {
            "post": {
                "tags": [
                    "Recurso: Consent register"
                ],
                "operationId": "acaoRevogarConsentimentos",
                "summary": "Action: Withdraw consent",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.consentimentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 500
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "consentimentos"
            }
        },
        "/r/conservacao_regras": {
            "get": {
                "tags": [
                    "Recurso: Retention periods"
                ],
                "operationId": "listarConservacaoRegras",
                "summary": "List Retention periods",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[categoria]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Category». List: a,b; range: f[categoria][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[acao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «At the end of the period». List: a,b; range: f[acao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_conservacao_regras"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "conservacao_regras"
            },
            "post": {
                "tags": [
                    "Recurso: Retention periods"
                ],
                "operationId": "criarConservacaoRegras",
                "summary": "Create Retention rule",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_conservacao_regras_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_conservacao_regras_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_conservacao_regras"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "conservacao_regras"
            }
        },
        "/r/conservacao_regras/esquema": {
            "get": {
                "tags": [
                    "Recurso: Retention periods"
                ],
                "operationId": "esquemaConservacaoRegras",
                "summary": "Schema of «Retention periods» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "conservacao_regras"
            }
        },
        "/r/conservacao_regras/{id}": {
            "get": {
                "tags": [
                    "Recurso: Retention periods"
                ],
                "operationId": "obterConservacaoRegras",
                "summary": "Get Retention rule",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_conservacao_regras"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "conservacao_regras"
            },
            "put": {
                "tags": [
                    "Recurso: Retention periods"
                ],
                "operationId": "alterarConservacaoRegras",
                "summary": "Update Retention rule",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_conservacao_regras_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_conservacao_regras"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "conservacao_regras"
            },
            "delete": {
                "tags": [
                    "Recurso: Retention periods"
                ],
                "operationId": "apagarConservacaoRegras",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "conservacao_regras"
            }
        },
        "/r/conservacao_regras/{id}/acao/executar_agora": {
            "post": {
                "tags": [
                    "Recurso: Retention periods"
                ],
                "operationId": "acaoExecutarAgoraConservacaoRegras",
                "summary": "Action: Run now",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "conservacao_regras"
            }
        },
        "/r/consultas": {
            "get": {
                "tags": [
                    "Recurso: Consultations"
                ],
                "operationId": "listarConsultas",
                "summary": "List Consultations",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[episodio_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Episode». List: a,b; range: f[episodio_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[data]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[data][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Consultation type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[medico_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Physician». List: a,b; range: f[medico_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[elegibilidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Eligibility». List: a,b; range: f[elegibilidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[escala]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Scale». List: a,b; range: f[escala][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tecnica]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Technique». List: a,b; range: f[tecnica][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[viabilidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Feasibility». List: a,b; range: f[viabilidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_consultas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consultas"
            }
        },
        "/r/consultas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Consultations"
                ],
                "operationId": "esquemaConsultas",
                "summary": "Schema of «Consultations» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consultas"
            }
        },
        "/r/consultas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Consultations"
                ],
                "operationId": "obterConsultas",
                "summary": "Get Consultation",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_consultas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "consultas"
            },
            "delete": {
                "tags": [
                    "Recurso: Consultations"
                ],
                "operationId": "apagarConsultas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "consultas"
            }
        },
        "/r/contas_pagadoras": {
            "get": {
                "tags": [
                    "Recurso: Paying accounts"
                ],
                "operationId": "listarContasPagadoras",
                "summary": "List Paying accounts",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[localidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Town». List: a,b; range: f[localidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[entidade_publica]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Public entity». List: a,b; range: f[entidade_publica][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_contas_pagadoras"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "contas_pagadoras"
            },
            "post": {
                "tags": [
                    "Recurso: Paying accounts"
                ],
                "operationId": "criarContasPagadoras",
                "summary": "Create Paying account",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_contas_pagadoras_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_contas_pagadoras_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_contas_pagadoras"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "contas_pagadoras"
            }
        },
        "/r/contas_pagadoras/esquema": {
            "get": {
                "tags": [
                    "Recurso: Paying accounts"
                ],
                "operationId": "esquemaContasPagadoras",
                "summary": "Schema of «Paying accounts» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "contas_pagadoras"
            }
        },
        "/r/contas_pagadoras/{id}": {
            "get": {
                "tags": [
                    "Recurso: Paying accounts"
                ],
                "operationId": "obterContasPagadoras",
                "summary": "Get Paying account",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_contas_pagadoras"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "contas_pagadoras"
            },
            "put": {
                "tags": [
                    "Recurso: Paying accounts"
                ],
                "operationId": "alterarContasPagadoras",
                "summary": "Update Paying account",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_contas_pagadoras_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_contas_pagadoras"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "contas_pagadoras"
            },
            "delete": {
                "tags": [
                    "Recurso: Paying accounts"
                ],
                "operationId": "apagarContasPagadoras",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "contas_pagadoras"
            }
        },
        "/r/contas_subcontas": {
            "get": {
                "tags": [
                    "Recurso: Sub-accounts"
                ],
                "operationId": "listarContasSubcontas",
                "summary": "List Sub-accounts",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[conta_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Paying account». List: a,b; range: f[conta_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_contas_subcontas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "contas_subcontas"
            },
            "post": {
                "tags": [
                    "Recurso: Sub-accounts"
                ],
                "operationId": "criarContasSubcontas",
                "summary": "Create Sub-account",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_contas_subcontas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_contas_subcontas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_contas_subcontas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "contas_subcontas"
            }
        },
        "/r/contas_subcontas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Sub-accounts"
                ],
                "operationId": "esquemaContasSubcontas",
                "summary": "Schema of «Sub-accounts» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "contas_subcontas"
            }
        },
        "/r/contas_subcontas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Sub-accounts"
                ],
                "operationId": "obterContasSubcontas",
                "summary": "Get Sub-account",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_contas_subcontas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "contas_subcontas"
            },
            "put": {
                "tags": [
                    "Recurso: Sub-accounts"
                ],
                "operationId": "alterarContasSubcontas",
                "summary": "Update Sub-account",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_contas_subcontas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_contas_subcontas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "contas_subcontas"
            },
            "delete": {
                "tags": [
                    "Recurso: Sub-accounts"
                ],
                "operationId": "apagarContasSubcontas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "contas_subcontas"
            }
        },
        "/r/convencoes": {
            "get": {
                "tags": [
                    "Recurso: Agreements"
                ],
                "operationId": "listarConvencoes",
                "summary": "List Agreements",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[conta_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Entity (paying account)». List: a,b; range: f[conta_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_convencoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "convencoes"
            },
            "post": {
                "tags": [
                    "Recurso: Agreements"
                ],
                "operationId": "criarConvencoes",
                "summary": "Create Agreement",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_convencoes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_convencoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_convencoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "convencoes"
            }
        },
        "/r/convencoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Agreements"
                ],
                "operationId": "esquemaConvencoes",
                "summary": "Schema of «Agreements» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "convencoes"
            }
        },
        "/r/convencoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Agreements"
                ],
                "operationId": "obterConvencoes",
                "summary": "Get Agreement",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_convencoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "convencoes"
            },
            "put": {
                "tags": [
                    "Recurso: Agreements"
                ],
                "operationId": "alterarConvencoes",
                "summary": "Update Agreement",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_convencoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_convencoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "convencoes"
            },
            "delete": {
                "tags": [
                    "Recurso: Agreements"
                ],
                "operationId": "apagarConvencoes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "convencoes"
            }
        },
        "/r/convencoes_atos": {
            "get": {
                "tags": [
                    "Recurso: Agreement procedures"
                ],
                "operationId": "listarConvencoesAtos",
                "summary": "List Agreement procedures",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[convencao_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Agreement». List: a,b; range: f[convencao_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[procedimento_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Procedure». List: a,b; range: f[procedimento_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_convencoes_atos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "convencoes_atos"
            },
            "post": {
                "tags": [
                    "Recurso: Agreement procedures"
                ],
                "operationId": "criarConvencoesAtos",
                "summary": "Create Agreement procedure",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_convencoes_atos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_convencoes_atos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_convencoes_atos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "convencoes_atos"
            }
        },
        "/r/convencoes_atos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Agreement procedures"
                ],
                "operationId": "esquemaConvencoesAtos",
                "summary": "Schema of «Agreement procedures» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "convencoes_atos"
            }
        },
        "/r/convencoes_atos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Agreement procedures"
                ],
                "operationId": "obterConvencoesAtos",
                "summary": "Get Agreement procedure",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_convencoes_atos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "convencoes_atos"
            },
            "put": {
                "tags": [
                    "Recurso: Agreement procedures"
                ],
                "operationId": "alterarConvencoesAtos",
                "summary": "Update Agreement procedure",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_convencoes_atos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_convencoes_atos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "convencoes_atos"
            },
            "delete": {
                "tags": [
                    "Recurso: Agreement procedures"
                ],
                "operationId": "apagarConvencoesAtos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "convencoes_atos"
            }
        },
        "/r/conversas": {
            "get": {
                "tags": [
                    "Recurso: Conversations"
                ],
                "operationId": "listarConversas",
                "summary": "List Conversations",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[departamento]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Department». List: a,b; range: f[departamento][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[atribuida_a]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Assigned to». List: a,b; range: f[atribuida_a][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ia_a_tratar]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «AI handling». List: a,b; range: f[ia_a_tratar][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ultima_mensagem_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Last message». List: a,b; range: f[ultima_mensagem_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[avaliacao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Rating (1–5)». List: a,b; range: f[avaliacao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_conversas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "conversas"
            }
        },
        "/r/conversas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Conversations"
                ],
                "operationId": "esquemaConversas",
                "summary": "Schema of «Conversations» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "conversas"
            }
        },
        "/r/conversas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Conversations"
                ],
                "operationId": "obterConversas",
                "summary": "Get Conversation",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_conversas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "conversas"
            },
            "put": {
                "tags": [
                    "Recurso: Conversations"
                ],
                "operationId": "alterarConversas",
                "summary": "Update Conversation",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_conversas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_conversas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "conversas"
            }
        },
        "/r/cuidados_conteudos": {
            "get": {
                "tags": [
                    "Recurso: Care by stage"
                ],
                "operationId": "listarCuidadosConteudos",
                "summary": "List Care by stage",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[procedimento_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Procedure». List: a,b; range: f[procedimento_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_cuidados_conteudos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cuidados_conteudos"
            },
            "post": {
                "tags": [
                    "Recurso: Care by stage"
                ],
                "operationId": "criarCuidadosConteudos",
                "summary": "Create Care content",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_cuidados_conteudos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_cuidados_conteudos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_cuidados_conteudos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cuidados_conteudos"
            }
        },
        "/r/cuidados_conteudos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Care by stage"
                ],
                "operationId": "esquemaCuidadosConteudos",
                "summary": "Schema of «Care by stage» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cuidados_conteudos"
            }
        },
        "/r/cuidados_conteudos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Care by stage"
                ],
                "operationId": "obterCuidadosConteudos",
                "summary": "Get Care content",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_cuidados_conteudos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "cuidados_conteudos"
            },
            "put": {
                "tags": [
                    "Recurso: Care by stage"
                ],
                "operationId": "alterarCuidadosConteudos",
                "summary": "Update Care content",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_cuidados_conteudos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_cuidados_conteudos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cuidados_conteudos"
            },
            "delete": {
                "tags": [
                    "Recurso: Care by stage"
                ],
                "operationId": "apagarCuidadosConteudos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cuidados_conteudos"
            }
        },
        "/r/cuidados_conteudos/{id}/acao/aprovar": {
            "post": {
                "tags": [
                    "Recurso: Care by stage"
                ],
                "operationId": "acaoAprovarCuidadosConteudos",
                "summary": "Action: Approve",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cuidados_conteudos"
            }
        },
        "/r/cuidados_conteudos/{id}/acao/devolver": {
            "post": {
                "tags": [
                    "Recurso: Care by stage"
                ],
                "operationId": "acaoDevolverCuidadosConteudos",
                "summary": "Action: Return for review",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cuidados_conteudos"
            }
        },
        "/r/cuidados_conteudos/{id}/acao/retirar": {
            "post": {
                "tags": [
                    "Recurso: Care by stage"
                ],
                "operationId": "acaoRetirarCuidadosConteudos",
                "summary": "Action: Withdraw",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cuidados_conteudos"
            }
        },
        "/r/cuidados_conteudos/{id}/acao/submeter": {
            "post": {
                "tags": [
                    "Recurso: Care by stage"
                ],
                "operationId": "acaoSubmeterCuidadosConteudos",
                "summary": "Action: Send for approval",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "cuidados_conteudos"
            }
        },
        "/r/custos_anuncios": {
            "get": {
                "tags": [
                    "Recurso: Ad costs"
                ],
                "operationId": "listarCustosAnuncios",
                "summary": "List Ad costs",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[plataforma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Platform». List: a,b; range: f[plataforma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[data]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[data][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_custos_anuncios"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "custos_anuncios"
            },
            "post": {
                "tags": [
                    "Recurso: Ad costs"
                ],
                "operationId": "criarCustosAnuncios",
                "summary": "Create Ad cost",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_custos_anuncios_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_custos_anuncios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_custos_anuncios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "custos_anuncios"
            }
        },
        "/r/custos_anuncios/esquema": {
            "get": {
                "tags": [
                    "Recurso: Ad costs"
                ],
                "operationId": "esquemaCustosAnuncios",
                "summary": "Schema of «Ad costs» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "custos_anuncios"
            }
        },
        "/r/custos_anuncios/{id}": {
            "get": {
                "tags": [
                    "Recurso: Ad costs"
                ],
                "operationId": "obterCustosAnuncios",
                "summary": "Get Ad cost",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_custos_anuncios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "custos_anuncios"
            },
            "put": {
                "tags": [
                    "Recurso: Ad costs"
                ],
                "operationId": "alterarCustosAnuncios",
                "summary": "Update Ad cost",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_custos_anuncios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_custos_anuncios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "custos_anuncios"
            },
            "delete": {
                "tags": [
                    "Recurso: Ad costs"
                ],
                "operationId": "apagarCustosAnuncios",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "custos_anuncios"
            }
        },
        "/r/datas_especiais": {
            "get": {
                "tags": [
                    "Recurso: Special dates"
                ],
                "operationId": "listarDatasEspeciais",
                "summary": "List Special dates",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_datas_especiais"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "datas_especiais"
            },
            "post": {
                "tags": [
                    "Recurso: Special dates"
                ],
                "operationId": "criarDatasEspeciais",
                "summary": "Create Special date",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_datas_especiais_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_datas_especiais_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_datas_especiais"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "datas_especiais"
            }
        },
        "/r/datas_especiais/esquema": {
            "get": {
                "tags": [
                    "Recurso: Special dates"
                ],
                "operationId": "esquemaDatasEspeciais",
                "summary": "Schema of «Special dates» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "datas_especiais"
            }
        },
        "/r/datas_especiais/{id}": {
            "get": {
                "tags": [
                    "Recurso: Special dates"
                ],
                "operationId": "obterDatasEspeciais",
                "summary": "Get Special date",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_datas_especiais"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "datas_especiais"
            },
            "put": {
                "tags": [
                    "Recurso: Special dates"
                ],
                "operationId": "alterarDatasEspeciais",
                "summary": "Update Special date",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_datas_especiais_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_datas_especiais"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "datas_especiais"
            },
            "delete": {
                "tags": [
                    "Recurso: Special dates"
                ],
                "operationId": "apagarDatasEspeciais",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "datas_especiais"
            }
        },
        "/r/datas_especiais/{id}/acao/processar": {
            "post": {
                "tags": [
                    "Recurso: Special dates"
                ],
                "operationId": "acaoProcessarDatasEspeciais",
                "summary": "Action: Run today",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "datas_especiais"
            }
        },
        "/r/delegacoes": {
            "get": {
                "tags": [
                    "Recurso: Delegations"
                ],
                "operationId": "listarDelegacoes",
                "summary": "List Delegations",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[de_utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Delegated by». List: a,b; range: f[de_utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[para_utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Delegated to». List: a,b; range: f[para_utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_delegacoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "delegacoes"
            },
            "post": {
                "tags": [
                    "Recurso: Delegations"
                ],
                "operationId": "criarDelegacoes",
                "summary": "Create Delegation",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_delegacoes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_delegacoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_delegacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "delegacoes"
            }
        },
        "/r/delegacoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Delegations"
                ],
                "operationId": "esquemaDelegacoes",
                "summary": "Schema of «Delegations» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "delegacoes"
            }
        },
        "/r/delegacoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Delegations"
                ],
                "operationId": "obterDelegacoes",
                "summary": "Get Delegation",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_delegacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "delegacoes"
            },
            "put": {
                "tags": [
                    "Recurso: Delegations"
                ],
                "operationId": "alterarDelegacoes",
                "summary": "Update Delegation",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_delegacoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_delegacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "delegacoes"
            },
            "delete": {
                "tags": [
                    "Recurso: Delegations"
                ],
                "operationId": "apagarDelegacoes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "delegacoes"
            }
        },
        "/r/delegacoes/{id}/acao/terminar": {
            "post": {
                "tags": [
                    "Recurso: Delegations"
                ],
                "operationId": "acaoTerminarDelegacoes",
                "summary": "Action: End",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "delegacoes"
            }
        },
        "/r/diagnosticos_apoio": {
            "get": {
                "tags": [
                    "Recurso: Support diagnoses"
                ],
                "operationId": "listarDiagnosticosApoio",
                "summary": "List Support diagnoses",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_diagnosticos_apoio"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "diagnosticos_apoio"
            },
            "post": {
                "tags": [
                    "Recurso: Support diagnoses"
                ],
                "operationId": "criarDiagnosticosApoio",
                "summary": "Create Support diagnosis",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_diagnosticos_apoio_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_diagnosticos_apoio_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_diagnosticos_apoio"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "diagnosticos_apoio"
            }
        },
        "/r/diagnosticos_apoio/esquema": {
            "get": {
                "tags": [
                    "Recurso: Support diagnoses"
                ],
                "operationId": "esquemaDiagnosticosApoio",
                "summary": "Schema of «Support diagnoses» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "diagnosticos_apoio"
            }
        },
        "/r/diagnosticos_apoio/{id}": {
            "get": {
                "tags": [
                    "Recurso: Support diagnoses"
                ],
                "operationId": "obterDiagnosticosApoio",
                "summary": "Get Support diagnosis",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_diagnosticos_apoio"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "diagnosticos_apoio"
            },
            "put": {
                "tags": [
                    "Recurso: Support diagnoses"
                ],
                "operationId": "alterarDiagnosticosApoio",
                "summary": "Update Support diagnosis",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_diagnosticos_apoio_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_diagnosticos_apoio"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "diagnosticos_apoio"
            },
            "delete": {
                "tags": [
                    "Recurso: Support diagnoses"
                ],
                "operationId": "apagarDiagnosticosApoio",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "diagnosticos_apoio"
            }
        },
        "/r/diagnosticos_apoio/{id}/acao/alternar": {
            "post": {
                "tags": [
                    "Recurso: Support diagnoses"
                ],
                "operationId": "acaoAlternarDiagnosticosApoio",
                "summary": "Action: Activate / deactivate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "diagnosticos_apoio"
            }
        },
        "/r/diagnosticos_apoio/{id}/acao/aprovar": {
            "post": {
                "tags": [
                    "Recurso: Support diagnoses"
                ],
                "operationId": "acaoAprovarDiagnosticosApoio",
                "summary": "Action: Approve",
                "description": "Required level: aprovar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "aprovar",
                "x-anagen-recurso": "diagnosticos_apoio"
            }
        },
        "/r/diagnosticos_apoio/{id}/acao/arquivar": {
            "post": {
                "tags": [
                    "Recurso: Support diagnoses"
                ],
                "operationId": "acaoArquivarDiagnosticosApoio",
                "summary": "Action: Archive",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "diagnosticos_apoio"
            }
        },
        "/r/documento_modelos": {
            "get": {
                "tags": [
                    "Recurso: Document templates"
                ],
                "operationId": "listarDocumentoModelos",
                "summary": "List Document templates",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_documento_modelos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documento_modelos"
            },
            "post": {
                "tags": [
                    "Recurso: Document templates"
                ],
                "operationId": "criarDocumentoModelos",
                "summary": "Create Document template",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_documento_modelos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_documento_modelos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_documento_modelos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documento_modelos"
            }
        },
        "/r/documento_modelos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Document templates"
                ],
                "operationId": "esquemaDocumentoModelos",
                "summary": "Schema of «Document templates» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documento_modelos"
            }
        },
        "/r/documento_modelos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Document templates"
                ],
                "operationId": "obterDocumentoModelos",
                "summary": "Get Document template",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_documento_modelos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documento_modelos"
            },
            "put": {
                "tags": [
                    "Recurso: Document templates"
                ],
                "operationId": "alterarDocumentoModelos",
                "summary": "Update Document template",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_documento_modelos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_documento_modelos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documento_modelos"
            },
            "delete": {
                "tags": [
                    "Recurso: Document templates"
                ],
                "operationId": "apagarDocumentoModelos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documento_modelos"
            }
        },
        "/r/documento_modelos/{id}/acao/aprovar": {
            "post": {
                "tags": [
                    "Recurso: Document templates"
                ],
                "operationId": "acaoAprovarDocumentoModelos",
                "summary": "Action: Approve",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "documento_modelos"
            }
        },
        "/r/documento_modelos/{id}/acao/arquivar": {
            "post": {
                "tags": [
                    "Recurso: Document templates"
                ],
                "operationId": "acaoArquivarDocumentoModelos",
                "summary": "Action: Archive",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documento_modelos"
            }
        },
        "/r/documento_modelos/{id}/acao/emitir": {
            "post": {
                "tags": [
                    "Recurso: Document templates"
                ],
                "operationId": "acaoEmitirDocumentoModelos",
                "summary": "Action: Issue document",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "documento_modelos"
            }
        },
        "/r/documento_modelos/{id}/acao/nova_versao": {
            "post": {
                "tags": [
                    "Recurso: Document templates"
                ],
                "operationId": "acaoNovaVersaoDocumentoModelos",
                "summary": "Action: New version",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documento_modelos"
            }
        },
        "/r/documentos": {
            "get": {
                "tags": [
                    "Recurso: Issued documents"
                ],
                "operationId": "listarDocumentos",
                "summary": "List Issued documents",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[episodio_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Episode». List: a,b; range: f[episodio_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[modelo_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Template». List: a,b; range: f[modelo_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[assinatura_tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Signature». List: a,b; range: f[assinatura_tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[partilhado_paciente]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Document shared on the portal.». List: a,b; range: f[partilhado_paciente][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[assinado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Signed on». List: a,b; range: f[assinado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[criado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Issued on». List: a,b; range: f[criado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_documentos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documentos"
            }
        },
        "/r/documentos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Issued documents"
                ],
                "operationId": "esquemaDocumentos",
                "summary": "Schema of «Issued documents» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documentos"
            }
        },
        "/r/documentos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Issued documents"
                ],
                "operationId": "obterDocumentos",
                "summary": "Get Document",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_documentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documentos"
            }
        },
        "/r/documentos/{id}/acao/anular": {
            "post": {
                "tags": [
                    "Recurso: Issued documents"
                ],
                "operationId": "acaoAnularDocumentos",
                "summary": "Action: Void",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 500
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documentos"
            }
        },
        "/r/documentos/{id}/acao/deixar_partilhar": {
            "post": {
                "tags": [
                    "Recurso: Issued documents"
                ],
                "operationId": "acaoDeixarPartilharDocumentos",
                "summary": "Action: Remove from the portal",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documentos"
            }
        },
        "/r/documentos/{id}/acao/partilhar": {
            "post": {
                "tags": [
                    "Recurso: Issued documents"
                ],
                "operationId": "acaoPartilharDocumentos",
                "summary": "Action: Share on the portal",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "documentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documentos"
            }
        },
        "/r/documentos_fiscais": {
            "get": {
                "tags": [
                    "Recurso: Tax documents"
                ],
                "operationId": "listarDocumentosFiscais",
                "summary": "List Tax documents",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[fornecedor]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Software». List: a,b; range: f[fornecedor][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[emitido_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Issued on». List: a,b; range: f[emitido_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[conta_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Paying account». List: a,b; range: f[conta_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[eletronica_estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «E-invoice». List: a,b; range: f[eletronica_estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_documentos_fiscais"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documentos_fiscais"
            }
        },
        "/r/documentos_fiscais/esquema": {
            "get": {
                "tags": [
                    "Recurso: Tax documents"
                ],
                "operationId": "esquemaDocumentosFiscais",
                "summary": "Schema of «Tax documents» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documentos_fiscais"
            }
        },
        "/r/documentos_fiscais/{id}": {
            "get": {
                "tags": [
                    "Recurso: Tax documents"
                ],
                "operationId": "obterDocumentosFiscais",
                "summary": "Get Tax document",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_documentos_fiscais"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "documentos_fiscais"
            }
        },
        "/r/documentos_fiscais/{id}/acao/enviar_paciente": {
            "post": {
                "tags": [
                    "Recurso: Tax documents"
                ],
                "operationId": "acaoEnviarPacienteDocumentosFiscais",
                "summary": "Action: Send to patient",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documentos_fiscais"
            }
        },
        "/r/documentos_fiscais/{id}/acao/nota_credito": {
            "post": {
                "tags": [
                    "Recurso: Tax documents"
                ],
                "operationId": "acaoNotaCreditoDocumentosFiscais",
                "summary": "Action: Issue credit note",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 255
                                    },
                                    "valor": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "title": "Amount to credit",
                                        "description": "Leave blank to credit the full available amount.",
                                        "minimum": 0.01,
                                        "x-moeda": "EUR",
                                        "x-casas": 2
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documentos_fiscais"
            }
        },
        "/r/documentos_fiscais/{id}/acao/reemitir": {
            "post": {
                "tags": [
                    "Recurso: Tax documents"
                ],
                "operationId": "acaoReemitirDocumentosFiscais",
                "summary": "Action: Try issuing again",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documentos_fiscais"
            }
        },
        "/r/documentos_fiscais/{id}/acao/registar_eletronica": {
            "post": {
                "tags": [
                    "Recurso: Tax documents"
                ],
                "operationId": "acaoRegistarEletronicaDocumentosFiscais",
                "summary": "Action: Record e-invoice",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "formato": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "E-invoice format",
                                        "enum": [
                                            "cius_pt",
                                            "pdf_assinado"
                                        ],
                                        "x-enum-rotulos": {
                                            "cius_pt": "CIUS-PT",
                                            "pdf_assinado": "PDF with qualified signature"
                                        },
                                        "default": "cius_pt"
                                    },
                                    "referencia": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Delivery reference",
                                        "description": "Reference given by the intermediary (eSPap, Saphety…) or by the signature provider.",
                                        "maxLength": 120
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documentos_fiscais"
            }
        },
        "/r/documentos_fiscais/{id}/acao/registar_emissao": {
            "post": {
                "tags": [
                    "Recurso: Tax documents"
                ],
                "operationId": "acaoRegistarEmissaoDocumentosFiscais",
                "summary": "Action: Record issue",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "numero": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Number",
                                        "maxLength": 60
                                    },
                                    "serie": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Series",
                                        "maxLength": 40
                                    },
                                    "atcud": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "ATCUD",
                                        "maxLength": 80
                                    },
                                    "emitido_em": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "title": "Issued on"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "documentos_fiscais"
            }
        },
        "/r/encomendas": {
            "get": {
                "tags": [
                    "Recurso: Orders"
                ],
                "operationId": "listarEncomendas",
                "summary": "List Orders",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[fornecedor]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Supplier». List: a,b; range: f[fornecedor][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_encomendas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "encomendas"
            },
            "post": {
                "tags": [
                    "Recurso: Orders"
                ],
                "operationId": "criarEncomendas",
                "summary": "Create Order",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_encomendas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_encomendas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_encomendas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "encomendas"
            }
        },
        "/r/encomendas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Orders"
                ],
                "operationId": "esquemaEncomendas",
                "summary": "Schema of «Orders» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "encomendas"
            }
        },
        "/r/encomendas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Orders"
                ],
                "operationId": "obterEncomendas",
                "summary": "Get Order",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_encomendas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "encomendas"
            },
            "put": {
                "tags": [
                    "Recurso: Orders"
                ],
                "operationId": "alterarEncomendas",
                "summary": "Update Order",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_encomendas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_encomendas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "encomendas"
            },
            "delete": {
                "tags": [
                    "Recurso: Orders"
                ],
                "operationId": "apagarEncomendas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "encomendas"
            }
        },
        "/r/encomendas/{id}/acao/cancelar": {
            "post": {
                "tags": [
                    "Recurso: Orders"
                ],
                "operationId": "acaoCancelarEncomendas",
                "summary": "Action: Cancel",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "encomendas"
            }
        },
        "/r/encomendas/{id}/acao/enviar": {
            "post": {
                "tags": [
                    "Recurso: Orders"
                ],
                "operationId": "acaoEnviarEncomendas",
                "summary": "Action: Send to supplier",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "encomendas"
            }
        },
        "/r/encomendas/{id}/acao/receber": {
            "post": {
                "tags": [
                    "Recurso: Orders"
                ],
                "operationId": "acaoReceberEncomendas",
                "summary": "Action: Receive",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "lote": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Batch",
                                        "description": "For items that require a batch.",
                                        "maxLength": 60
                                    },
                                    "validade": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "title": "Expiry date"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "encomendas"
            }
        },
        "/r/episodios": {
            "get": {
                "tags": [
                    "Recurso: Episodes"
                ],
                "operationId": "listarEpisodios",
                "summary": "List Episodes",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[procedimento_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Procedure». List: a,b; range: f[procedimento_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tecnica]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Technique». List: a,b; range: f[tecnica][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[area]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Area». List: a,b; range: f[area][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[medico_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Lead physician». List: a,b; range: f[medico_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[aberto_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Opened on». List: a,b; range: f[aberto_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_episodios"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "episodios"
            },
            "post": {
                "tags": [
                    "Recurso: Episodes"
                ],
                "operationId": "criarEpisodios",
                "summary": "Create Episode",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_episodios_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_episodios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_episodios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "episodios"
            }
        },
        "/r/episodios/esquema": {
            "get": {
                "tags": [
                    "Recurso: Episodes"
                ],
                "operationId": "esquemaEpisodios",
                "summary": "Schema of «Episodes» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "episodios"
            }
        },
        "/r/episodios/{id}": {
            "get": {
                "tags": [
                    "Recurso: Episodes"
                ],
                "operationId": "obterEpisodios",
                "summary": "Get Episode",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_episodios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "episodios"
            },
            "put": {
                "tags": [
                    "Recurso: Episodes"
                ],
                "operationId": "alterarEpisodios",
                "summary": "Update Episode",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_episodios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_episodios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "episodios"
            },
            "delete": {
                "tags": [
                    "Recurso: Episodes"
                ],
                "operationId": "apagarEpisodios",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "episodios"
            }
        },
        "/r/episodios/{id}/acao/adicionar_equipa": {
            "post": {
                "tags": [
                    "Recurso: Episodes"
                ],
                "operationId": "acaoAdicionarEquipaEpisodios",
                "summary": "Action: Add to team",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "utilizador_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "title": "Professional",
                                        "x-anagen-recurso": "utilizadores"
                                    },
                                    "papel": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Role",
                                        "enum": [
                                            "medico",
                                            "cirurgiao",
                                            "enfermeiro",
                                            "tecnico",
                                            "assistente",
                                            "anestesista",
                                            "coordenador",
                                            "comercial",
                                            "outro"
                                        ],
                                        "x-enum-rotulos": {
                                            "medico": "Physician",
                                            "cirurgiao": "Surgeon",
                                            "enfermeiro": "Nurse",
                                            "tecnico": "Technician",
                                            "assistente": "Assistant",
                                            "anestesista": "Anaesthetist",
                                            "coordenador": "Coordinator",
                                            "comercial": "Patient advisor",
                                            "outro": "Other"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "episodios"
            }
        },
        "/r/episodios/{id}/acao/mudar_estado": {
            "post": {
                "tags": [
                    "Recurso: Episodes"
                ],
                "operationId": "acaoMudarEstadoEpisodios",
                "summary": "Action: Change status",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "estado": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Status",
                                        "enum": [
                                            "avaliacao",
                                            "plano",
                                            "proposta",
                                            "agendado",
                                            "pre_operatorio",
                                            "cirurgia",
                                            "pos_operatorio",
                                            "acompanhamento",
                                            "concluido",
                                            "cancelado"
                                        ],
                                        "x-enum-rotulos": {
                                            "avaliacao": "Assessment",
                                            "plano": "Plan",
                                            "proposta": "Proposal",
                                            "agendado": "Scheduled",
                                            "pre_operatorio": "Pre-operative",
                                            "cirurgia": "Surgery",
                                            "pos_operatorio": "Post-operative",
                                            "acompanhamento": "Follow-up",
                                            "concluido": "Completed",
                                            "cancelado": "Cancelled"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "episodios"
            }
        },
        "/r/episodios_equipa": {
            "get": {
                "tags": [
                    "Recurso: Episode teams"
                ],
                "operationId": "listarEpisodiosEquipa",
                "summary": "List Episode teams",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[episodio_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Episode». List: a,b; range: f[episodio_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Professional». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[papel]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Role». List: a,b; range: f[papel][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_episodios_equipa"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "episodios_equipa"
            },
            "post": {
                "tags": [
                    "Recurso: Episode teams"
                ],
                "operationId": "criarEpisodiosEquipa",
                "summary": "Create Team membership",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_episodios_equipa_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_episodios_equipa_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_episodios_equipa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "episodios_equipa"
            }
        },
        "/r/episodios_equipa/esquema": {
            "get": {
                "tags": [
                    "Recurso: Episode teams"
                ],
                "operationId": "esquemaEpisodiosEquipa",
                "summary": "Schema of «Episode teams» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "episodios_equipa"
            }
        },
        "/r/episodios_equipa/{id}": {
            "get": {
                "tags": [
                    "Recurso: Episode teams"
                ],
                "operationId": "obterEpisodiosEquipa",
                "summary": "Get Team membership",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_episodios_equipa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "episodios_equipa"
            },
            "put": {
                "tags": [
                    "Recurso: Episode teams"
                ],
                "operationId": "alterarEpisodiosEquipa",
                "summary": "Update Team membership",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_episodios_equipa_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_episodios_equipa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "episodios_equipa"
            },
            "delete": {
                "tags": [
                    "Recurso: Episode teams"
                ],
                "operationId": "apagarEpisodiosEquipa",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "episodios_equipa"
            }
        },
        "/r/episodios_equipa/{id}/acao/terminar": {
            "post": {
                "tags": [
                    "Recurso: Episode teams"
                ],
                "operationId": "acaoTerminarEpisodiosEquipa",
                "summary": "Action: End membership",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "episodios_equipa"
            }
        },
        "/r/equipamentos": {
            "get": {
                "tags": [
                    "Recurso: Equipment"
                ],
                "operationId": "listarEquipamentos",
                "summary": "List Equipment",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[dispositivo_medico]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Medical device». List: a,b; range: f[dispositivo_medico][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[classe]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Class». List: a,b; range: f[classe][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[localizacao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Location». List: a,b; range: f[localizacao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[proxima_manutencao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Next maintenance». List: a,b; range: f[proxima_manutencao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_equipamentos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipamentos"
            },
            "post": {
                "tags": [
                    "Recurso: Equipment"
                ],
                "operationId": "criarEquipamentos",
                "summary": "Create Equipment item",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_equipamentos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_equipamentos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_equipamentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "equipamentos"
            }
        },
        "/r/equipamentos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Equipment"
                ],
                "operationId": "esquemaEquipamentos",
                "summary": "Schema of «Equipment» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipamentos"
            }
        },
        "/r/equipamentos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Equipment"
                ],
                "operationId": "obterEquipamentos",
                "summary": "Get Equipment item",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_equipamentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipamentos"
            },
            "put": {
                "tags": [
                    "Recurso: Equipment"
                ],
                "operationId": "alterarEquipamentos",
                "summary": "Update Equipment item",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_equipamentos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_equipamentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "equipamentos"
            },
            "delete": {
                "tags": [
                    "Recurso: Equipment"
                ],
                "operationId": "apagarEquipamentos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "equipamentos"
            }
        },
        "/r/equipamentos/{id}/acao/registar_manutencao": {
            "post": {
                "tags": [
                    "Recurso: Equipment"
                ],
                "operationId": "acaoRegistarManutencaoEquipamentos",
                "summary": "Action: Record maintenance",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "equipamentos"
            }
        },
        "/r/equipamentos_registos": {
            "get": {
                "tags": [
                    "Recurso: Maintenance and records"
                ],
                "operationId": "listarEquipamentosRegistos",
                "summary": "List Maintenance and records",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[equipamento_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Equipment item». List: a,b; range: f[equipamento_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[data]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[data][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_equipamentos_registos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipamentos_registos"
            },
            "post": {
                "tags": [
                    "Recurso: Maintenance and records"
                ],
                "operationId": "criarEquipamentosRegistos",
                "summary": "Create Equipment record",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_equipamentos_registos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_equipamentos_registos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_equipamentos_registos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "equipamentos_registos"
            }
        },
        "/r/equipamentos_registos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Maintenance and records"
                ],
                "operationId": "esquemaEquipamentosRegistos",
                "summary": "Schema of «Maintenance and records» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipamentos_registos"
            }
        },
        "/r/equipamentos_registos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Maintenance and records"
                ],
                "operationId": "obterEquipamentosRegistos",
                "summary": "Get Equipment record",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_equipamentos_registos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipamentos_registos"
            },
            "put": {
                "tags": [
                    "Recurso: Maintenance and records"
                ],
                "operationId": "alterarEquipamentosRegistos",
                "summary": "Update Equipment record",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_equipamentos_registos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_equipamentos_registos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "equipamentos_registos"
            },
            "delete": {
                "tags": [
                    "Recurso: Maintenance and records"
                ],
                "operationId": "apagarEquipamentosRegistos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "equipamentos_registos"
            }
        },
        "/r/equipas": {
            "get": {
                "tags": [
                    "Recurso: Teams"
                ],
                "operationId": "listarEquipas",
                "summary": "List Teams",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[departamento]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Department». List: a,b; range: f[departamento][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[chefe_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Team leader». List: a,b; range: f[chefe_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_equipas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipas"
            },
            "post": {
                "tags": [
                    "Recurso: Teams"
                ],
                "operationId": "criarEquipas",
                "summary": "Create Team",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_equipas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_equipas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_equipas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "equipas"
            }
        },
        "/r/equipas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Teams"
                ],
                "operationId": "esquemaEquipas",
                "summary": "Schema of «Teams» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipas"
            }
        },
        "/r/equipas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Teams"
                ],
                "operationId": "obterEquipas",
                "summary": "Get Team",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_equipas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "equipas"
            },
            "put": {
                "tags": [
                    "Recurso: Teams"
                ],
                "operationId": "alterarEquipas",
                "summary": "Update Team",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_equipas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_equipas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "equipas"
            },
            "delete": {
                "tags": [
                    "Recurso: Teams"
                ],
                "operationId": "apagarEquipas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "equipas"
            }
        },
        "/r/feriados": {
            "get": {
                "tags": [
                    "Recurso: Public holidays"
                ],
                "operationId": "listarFeriados",
                "summary": "List Public holidays",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[data]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[data][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ambito]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Scope». List: a,b; range: f[ambito][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_feriados"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "feriados"
            },
            "post": {
                "tags": [
                    "Recurso: Public holidays"
                ],
                "operationId": "criarFeriados",
                "summary": "Create Public holiday",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_feriados_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_feriados_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_feriados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "feriados"
            }
        },
        "/r/feriados/esquema": {
            "get": {
                "tags": [
                    "Recurso: Public holidays"
                ],
                "operationId": "esquemaFeriados",
                "summary": "Schema of «Public holidays» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "feriados"
            }
        },
        "/r/feriados/{id}": {
            "get": {
                "tags": [
                    "Recurso: Public holidays"
                ],
                "operationId": "obterFeriados",
                "summary": "Get Public holiday",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_feriados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "feriados"
            },
            "put": {
                "tags": [
                    "Recurso: Public holidays"
                ],
                "operationId": "alterarFeriados",
                "summary": "Update Public holiday",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_feriados_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_feriados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "feriados"
            },
            "delete": {
                "tags": [
                    "Recurso: Public holidays"
                ],
                "operationId": "apagarFeriados",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "feriados"
            }
        },
        "/r/formacoes": {
            "get": {
                "tags": [
                    "Recurso: Team training"
                ],
                "operationId": "listarFormacoes",
                "summary": "List Team training",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Person». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tema]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Topic». List: a,b; range: f[tema][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[data]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[data][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[validade_ate]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Valid until». List: a,b; range: f[validade_ate][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_formacoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formacoes"
            },
            "post": {
                "tags": [
                    "Recurso: Team training"
                ],
                "operationId": "criarFormacoes",
                "summary": "Create Training",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_formacoes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_formacoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_formacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formacoes"
            }
        },
        "/r/formacoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Team training"
                ],
                "operationId": "esquemaFormacoes",
                "summary": "Schema of «Team training» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formacoes"
            }
        },
        "/r/formacoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Team training"
                ],
                "operationId": "obterFormacoes",
                "summary": "Get Training",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_formacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formacoes"
            },
            "put": {
                "tags": [
                    "Recurso: Team training"
                ],
                "operationId": "alterarFormacoes",
                "summary": "Update Training",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_formacoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_formacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formacoes"
            },
            "delete": {
                "tags": [
                    "Recurso: Team training"
                ],
                "operationId": "apagarFormacoes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formacoes"
            }
        },
        "/r/formularios": {
            "get": {
                "tags": [
                    "Recurso: Forms"
                ],
                "operationId": "listarFormularios",
                "summary": "List Forms",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tecnica]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Technique». List: a,b; range: f[tecnica][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[modelo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Library template». List: a,b; range: f[modelo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_formularios"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formularios"
            },
            "post": {
                "tags": [
                    "Recurso: Forms"
                ],
                "operationId": "criarFormularios",
                "summary": "Create Form",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_formularios_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_formularios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_formularios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formularios"
            }
        },
        "/r/formularios/esquema": {
            "get": {
                "tags": [
                    "Recurso: Forms"
                ],
                "operationId": "esquemaFormularios",
                "summary": "Schema of «Forms» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formularios"
            }
        },
        "/r/formularios/{id}": {
            "get": {
                "tags": [
                    "Recurso: Forms"
                ],
                "operationId": "obterFormularios",
                "summary": "Get Form",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_formularios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formularios"
            },
            "put": {
                "tags": [
                    "Recurso: Forms"
                ],
                "operationId": "alterarFormularios",
                "summary": "Update Form",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_formularios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_formularios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formularios"
            },
            "delete": {
                "tags": [
                    "Recurso: Forms"
                ],
                "operationId": "apagarFormularios",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formularios"
            }
        },
        "/r/formularios/{id}/acao/alternar": {
            "post": {
                "tags": [
                    "Recurso: Forms"
                ],
                "operationId": "acaoAlternarFormularios",
                "summary": "Action: Activate / deactivate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formularios"
            }
        },
        "/r/formularios/{id}/acao/duplicar": {
            "post": {
                "tags": [
                    "Recurso: Forms"
                ],
                "operationId": "acaoDuplicarFormularios",
                "summary": "Action: Duplicate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nome": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Name",
                                        "maxLength": 160
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formularios"
            }
        },
        "/r/formularios/{id}/acao/pedir": {
            "post": {
                "tags": [
                    "Recurso: Forms"
                ],
                "operationId": "acaoPedirFormularios",
                "summary": "Action: Request form",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "title": "Patient",
                                        "x-anagen-recurso": "pacientes"
                                    },
                                    "canal": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Channel",
                                        "enum": [
                                            "email",
                                            "sms",
                                            "whatsapp",
                                            "ligacao"
                                        ],
                                        "x-enum-rotulos": {
                                            "email": "Email",
                                            "sms": "SMS",
                                            "whatsapp": "WhatsApp",
                                            "ligacao": "Link only (share manually)"
                                        },
                                        "default": "email"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formularios"
            }
        },
        "/r/formularios/{id}/acao/traduzir": {
            "post": {
                "tags": [
                    "Recurso: Forms"
                ],
                "operationId": "acaoTraduzirFormularios",
                "summary": "Action: Translate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "idioma": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Target language",
                                        "enum": [
                                            "pt-PT",
                                            "pt-BR",
                                            "en",
                                            "es",
                                            "fr",
                                            "de"
                                        ],
                                        "x-enum-rotulos": {
                                            "pt-PT": "Portuguese (Portugal)",
                                            "pt-BR": "Portuguese (Brazil)",
                                            "en": "English",
                                            "es": "Spanish",
                                            "fr": "French",
                                            "de": "German"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formularios"
            }
        },
        "/r/formularios_respostas": {
            "get": {
                "tags": [
                    "Recurso: Form responses"
                ],
                "operationId": "listarFormulariosRespostas",
                "summary": "List Form responses",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[formulario_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Form». List: a,b; range: f[formulario_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[episodio_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Episode». List: a,b; range: f[episodio_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Source». List: a,b; range: f[origem][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[alarme]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Warning sign». List: a,b; range: f[alarme][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[preenchido_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Completed on». List: a,b; range: f[preenchido_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_formularios_respostas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formularios_respostas"
            }
        },
        "/r/formularios_respostas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Form responses"
                ],
                "operationId": "esquemaFormulariosRespostas",
                "summary": "Schema of «Form responses» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formularios_respostas"
            }
        },
        "/r/formularios_respostas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Form responses"
                ],
                "operationId": "obterFormulariosRespostas",
                "summary": "Get Form response",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_formularios_respostas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "formularios_respostas"
            }
        },
        "/r/formularios_respostas/{id}/acao/devolver": {
            "post": {
                "tags": [
                    "Recurso: Form responses"
                ],
                "operationId": "acaoDevolverFormulariosRespostas",
                "summary": "Action: Return to patient",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "pedido": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Request for information",
                                        "description": "Text the patient sees when reopening the form. State clearly what is missing.",
                                        "maxLength": 2000
                                    },
                                    "canal": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Channel",
                                        "enum": [
                                            "email",
                                            "sms",
                                            "whatsapp",
                                            "ligacao"
                                        ],
                                        "x-enum-rotulos": {
                                            "email": "Email",
                                            "sms": "SMS",
                                            "whatsapp": "WhatsApp",
                                            "ligacao": "Link only (share manually)"
                                        },
                                        "default": "email"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formularios_respostas"
            }
        },
        "/r/formularios_respostas/{id}/acao/rejeitar": {
            "post": {
                "tags": [
                    "Recurso: Form responses"
                ],
                "operationId": "acaoRejeitarFormulariosRespostas",
                "summary": "Action: Reject",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 400
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formularios_respostas"
            }
        },
        "/r/formularios_respostas/{id}/acao/validar": {
            "post": {
                "tags": [
                    "Recurso: Form responses"
                ],
                "operationId": "acaoValidarFormulariosRespostas",
                "summary": "Action: Validate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "formularios_respostas"
            }
        },
        "/r/fotos": {
            "get": {
                "tags": [
                    "Recurso: Photographs"
                ],
                "operationId": "listarFotos",
                "summary": "List Photographs",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[data]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[data][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[vista]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «View». List: a,b; range: f[vista][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[zona]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Zone». List: a,b; range: f[zona][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[album]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Album». List: a,b; range: f[album][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Source». List: a,b; range: f[origem][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[partilhada_paciente]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Shared with the patient». List: a,b; range: f[partilhada_paciente][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[qualidade_ok]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Sufficient quality». List: a,b; range: f[qualidade_ok][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[rosto_desfocado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Face blurred». List: a,b; range: f[rosto_desfocado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[simulacao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Simulation». List: a,b; range: f[simulacao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_fotos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "fotos"
            },
            "post": {
                "tags": [
                    "Recurso: Photographs"
                ],
                "operationId": "criarFotos",
                "summary": "Create Photograph",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_fotos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_fotos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_fotos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "fotos"
            }
        },
        "/r/fotos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Photographs"
                ],
                "operationId": "esquemaFotos",
                "summary": "Schema of «Photographs» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "fotos"
            }
        },
        "/r/fotos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Photographs"
                ],
                "operationId": "obterFotos",
                "summary": "Get Photograph",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_fotos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "fotos"
            },
            "put": {
                "tags": [
                    "Recurso: Photographs"
                ],
                "operationId": "alterarFotos",
                "summary": "Update Photograph",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_fotos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_fotos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "fotos"
            },
            "delete": {
                "tags": [
                    "Recurso: Photographs"
                ],
                "operationId": "apagarFotos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "fotos"
            }
        },
        "/r/fotos/{id}/acao/aceitar": {
            "post": {
                "tags": [
                    "Recurso: Photographs"
                ],
                "operationId": "acaoAceitarFotos",
                "summary": "Action: Accept",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "fotos"
            }
        },
        "/r/fotos/{id}/acao/deixar_partilhar": {
            "post": {
                "tags": [
                    "Recurso: Photographs"
                ],
                "operationId": "acaoDeixarPartilharFotos",
                "summary": "Action: Stop sharing",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "fotos"
            }
        },
        "/r/fotos/{id}/acao/partilhar": {
            "post": {
                "tags": [
                    "Recurso: Photographs"
                ],
                "operationId": "acaoPartilharFotos",
                "summary": "Action: Share with the patient",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "fotos"
            }
        },
        "/r/fotos/{id}/acao/rejeitar": {
            "post": {
                "tags": [
                    "Recurso: Photographs"
                ],
                "operationId": "acaoRejeitarFotos",
                "summary": "Action: Reject",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.fotografias:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "resposta": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reply to the patient",
                                        "description": "Visible to the patient in the portal. No clinical details.",
                                        "maxLength": 1000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "fotos"
            }
        },
        "/r/funil_fases": {
            "get": {
                "tags": [
                    "Recurso: Pipeline stages"
                ],
                "operationId": "listarFunilFases",
                "summary": "List Pipeline stages",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[funil_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Funnel». List: a,b; range: f[funil_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_funil_fases"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "funil_fases"
            },
            "post": {
                "tags": [
                    "Recurso: Pipeline stages"
                ],
                "operationId": "criarFunilFases",
                "summary": "Create Pipeline stage",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_funil_fases_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_funil_fases_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_funil_fases"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "funil_fases"
            }
        },
        "/r/funil_fases/esquema": {
            "get": {
                "tags": [
                    "Recurso: Pipeline stages"
                ],
                "operationId": "esquemaFunilFases",
                "summary": "Schema of «Pipeline stages» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "funil_fases"
            }
        },
        "/r/funil_fases/{id}": {
            "get": {
                "tags": [
                    "Recurso: Pipeline stages"
                ],
                "operationId": "obterFunilFases",
                "summary": "Get Pipeline stage",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_funil_fases"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "funil_fases"
            },
            "put": {
                "tags": [
                    "Recurso: Pipeline stages"
                ],
                "operationId": "alterarFunilFases",
                "summary": "Update Pipeline stage",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_funil_fases_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_funil_fases"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "funil_fases"
            },
            "delete": {
                "tags": [
                    "Recurso: Pipeline stages"
                ],
                "operationId": "apagarFunilFases",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "funil_fases"
            }
        },
        "/r/funis": {
            "get": {
                "tags": [
                    "Recurso: Market funnels"
                ],
                "operationId": "listarFunis",
                "summary": "List Market funnels",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_funis"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "funis"
            },
            "post": {
                "tags": [
                    "Recurso: Market funnels"
                ],
                "operationId": "criarFunis",
                "summary": "Create Funnel",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_funis_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_funis_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_funis"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "funis"
            }
        },
        "/r/funis/esquema": {
            "get": {
                "tags": [
                    "Recurso: Market funnels"
                ],
                "operationId": "esquemaFunis",
                "summary": "Schema of «Market funnels» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "funis"
            }
        },
        "/r/funis/{id}": {
            "get": {
                "tags": [
                    "Recurso: Market funnels"
                ],
                "operationId": "obterFunis",
                "summary": "Get Funnel",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_funis"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "funis"
            },
            "put": {
                "tags": [
                    "Recurso: Market funnels"
                ],
                "operationId": "alterarFunis",
                "summary": "Update Funnel",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_funis_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_funis"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "funis"
            },
            "delete": {
                "tags": [
                    "Recurso: Market funnels"
                ],
                "operationId": "apagarFunis",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "funis"
            }
        },
        "/r/funis/{id}/acao/criar_fases": {
            "post": {
                "tags": [
                    "Recurso: Market funnels"
                ],
                "operationId": "acaoCriarFasesFunis",
                "summary": "Action: Create stages from the main funnel",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "funis"
            }
        },
        "/r/guioes": {
            "get": {
                "tags": [
                    "Recurso: Call scripts"
                ],
                "operationId": "listarGuioes",
                "summary": "List Call scripts",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[finalidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Purpose». List: a,b; range: f[finalidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_guioes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "guioes"
            },
            "post": {
                "tags": [
                    "Recurso: Call scripts"
                ],
                "operationId": "criarGuioes",
                "summary": "Create Call script",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_guioes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_guioes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_guioes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "guioes"
            }
        },
        "/r/guioes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Call scripts"
                ],
                "operationId": "esquemaGuioes",
                "summary": "Schema of «Call scripts» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "guioes"
            }
        },
        "/r/guioes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Call scripts"
                ],
                "operationId": "obterGuioes",
                "summary": "Get Call script",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_guioes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "guioes"
            },
            "put": {
                "tags": [
                    "Recurso: Call scripts"
                ],
                "operationId": "alterarGuioes",
                "summary": "Update Call script",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_guioes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_guioes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "guioes"
            },
            "delete": {
                "tags": [
                    "Recurso: Call scripts"
                ],
                "operationId": "apagarGuioes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "guioes"
            }
        },
        "/r/honorarios": {
            "get": {
                "tags": [
                    "Recurso: Fees"
                ],
                "operationId": "listarHonorarios",
                "summary": "List Fees",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Doctor». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[data_ato]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date of the act». List: a,b; range: f[data_ato][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[cirurgia_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Surgery». List: a,b; range: f[cirurgia_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_honorarios"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "honorarios"
            },
            "post": {
                "tags": [
                    "Recurso: Fees"
                ],
                "operationId": "criarHonorarios",
                "summary": "Create Fee",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_honorarios_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_honorarios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_honorarios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "honorarios"
            }
        },
        "/r/honorarios/esquema": {
            "get": {
                "tags": [
                    "Recurso: Fees"
                ],
                "operationId": "esquemaHonorarios",
                "summary": "Schema of «Fees» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "honorarios"
            }
        },
        "/r/honorarios/{id}": {
            "get": {
                "tags": [
                    "Recurso: Fees"
                ],
                "operationId": "obterHonorarios",
                "summary": "Get Fee",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_honorarios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "honorarios"
            },
            "put": {
                "tags": [
                    "Recurso: Fees"
                ],
                "operationId": "alterarHonorarios",
                "summary": "Update Fee",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_honorarios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_honorarios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "honorarios"
            }
        },
        "/r/honorarios/{id}/acao/marcar_pago": {
            "post": {
                "tags": [
                    "Recurso: Fees"
                ],
                "operationId": "acaoMarcarPagoHonorarios",
                "summary": "Action: Mark as paid",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.valores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "referencia": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Payment reference",
                                        "maxLength": 80
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "honorarios"
            }
        },
        "/r/horarios": {
            "get": {
                "tags": [
                    "Recurso: Working hours"
                ],
                "operationId": "listarHorarios",
                "summary": "List Working hours",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Practitioner». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[recurso_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Room or resource». List: a,b; range: f[recurso_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[dia_semana]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Day of the week». List: a,b; range: f[dia_semana][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_horarios"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "horarios"
            },
            "post": {
                "tags": [
                    "Recurso: Working hours"
                ],
                "operationId": "criarHorarios",
                "summary": "Create Working hours",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_horarios_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_horarios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_horarios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "horarios"
            }
        },
        "/r/horarios/esquema": {
            "get": {
                "tags": [
                    "Recurso: Working hours"
                ],
                "operationId": "esquemaHorarios",
                "summary": "Schema of «Working hours» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "horarios"
            }
        },
        "/r/horarios/{id}": {
            "get": {
                "tags": [
                    "Recurso: Working hours"
                ],
                "operationId": "obterHorarios",
                "summary": "Get Working hours",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_horarios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "horarios"
            },
            "put": {
                "tags": [
                    "Recurso: Working hours"
                ],
                "operationId": "alterarHorarios",
                "summary": "Update Working hours",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_horarios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_horarios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "horarios"
            },
            "delete": {
                "tags": [
                    "Recurso: Working hours"
                ],
                "operationId": "apagarHorarios",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "horarios"
            }
        },
        "/r/ia_pedidos": {
            "get": {
                "tags": [
                    "Recurso: AI requests"
                ],
                "operationId": "listarIaPedidos",
                "summary": "List AI requests",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tarefa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Use». List: a,b; range: f[tarefa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[fornecedor]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Service». List: a,b; range: f[fornecedor][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Requested by». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_ia_pedidos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ia_pedidos"
            }
        },
        "/r/ia_pedidos/esquema": {
            "get": {
                "tags": [
                    "Recurso: AI requests"
                ],
                "operationId": "esquemaIaPedidos",
                "summary": "Schema of «AI requests» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ia_pedidos"
            }
        },
        "/r/ia_pedidos/{id}": {
            "get": {
                "tags": [
                    "Recurso: AI requests"
                ],
                "operationId": "obterIaPedidos",
                "summary": "Get AI request",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_ia_pedidos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ia_pedidos"
            }
        },
        "/r/ia_propostas": {
            "get": {
                "tags": [
                    "Recurso: AI proposals"
                ],
                "operationId": "listarIaPropostas",
                "summary": "List AI proposals",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[consulta_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Consultation». List: a,b; range: f[consulta_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[fornecedor]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Service». List: a,b; range: f[fornecedor][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[modelo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Model». List: a,b; range: f[modelo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[decidido_por]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Decided by». List: a,b; range: f[decidido_por][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[criado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Created on». List: a,b; range: f[criado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_ia_propostas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ia_propostas"
            }
        },
        "/r/ia_propostas/esquema": {
            "get": {
                "tags": [
                    "Recurso: AI proposals"
                ],
                "operationId": "esquemaIaPropostas",
                "summary": "Schema of «AI proposals» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ia_propostas"
            }
        },
        "/r/ia_propostas/{id}": {
            "get": {
                "tags": [
                    "Recurso: AI proposals"
                ],
                "operationId": "obterIaPropostas",
                "summary": "Get AI proposal",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_ia_propostas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "ia_propostas"
            }
        },
        "/r/ia_propostas/{id}/acao/aceitar": {
            "post": {
                "tags": [
                    "Recurso: AI proposals"
                ],
                "operationId": "acaoAceitarIaPropostas",
                "summary": "Action: Accept",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "ia_propostas"
            }
        },
        "/r/ia_propostas/{id}/acao/corrigir": {
            "post": {
                "tags": [
                    "Recurso: AI proposals"
                ],
                "operationId": "acaoCorrigirIaPropostas",
                "summary": "Action: Correct",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "valor_final": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Final value",
                                        "maxLength": 20000
                                    },
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 400
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "ia_propostas"
            }
        },
        "/r/ia_propostas/{id}/acao/recusar": {
            "post": {
                "tags": [
                    "Recurso: AI proposals"
                ],
                "operationId": "acaoRecusarIaPropostas",
                "summary": "Action: Decline",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 400
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "ia_propostas"
            }
        },
        "/r/imagens_marketing": {
            "get": {
                "tags": [
                    "Recurso: Image library"
                ],
                "operationId": "listarImagensMarketing",
                "summary": "List Image library",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[procedimento_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Procedure». List: a,b; range: f[procedimento_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_imagens_marketing"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "imagens_marketing"
            },
            "post": {
                "tags": [
                    "Recurso: Image library"
                ],
                "operationId": "criarImagensMarketing",
                "summary": "Create Image",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_imagens_marketing_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_imagens_marketing_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_imagens_marketing"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "imagens_marketing"
            }
        },
        "/r/imagens_marketing/esquema": {
            "get": {
                "tags": [
                    "Recurso: Image library"
                ],
                "operationId": "esquemaImagensMarketing",
                "summary": "Schema of «Image library» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "imagens_marketing"
            }
        },
        "/r/imagens_marketing/{id}": {
            "get": {
                "tags": [
                    "Recurso: Image library"
                ],
                "operationId": "obterImagensMarketing",
                "summary": "Get Image",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_imagens_marketing"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "imagens_marketing"
            },
            "put": {
                "tags": [
                    "Recurso: Image library"
                ],
                "operationId": "alterarImagensMarketing",
                "summary": "Update Image",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_imagens_marketing_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_imagens_marketing"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "imagens_marketing"
            },
            "delete": {
                "tags": [
                    "Recurso: Image library"
                ],
                "operationId": "apagarImagensMarketing",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "imagens_marketing"
            }
        },
        "/r/imagens_marketing/{id}/acao/retirar": {
            "post": {
                "tags": [
                    "Recurso: Image library"
                ],
                "operationId": "acaoRetirarImagensMarketing",
                "summary": "Action: Withdraw",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo_retirada": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Withdrawal reason",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "imagens_marketing"
            }
        },
        "/r/importacoes": {
            "get": {
                "tags": [
                    "Recurso: Imports"
                ],
                "operationId": "listarImportacoes",
                "summary": "List Imports",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_importacoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "importacoes"
            }
        },
        "/r/importacoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Imports"
                ],
                "operationId": "esquemaImportacoes",
                "summary": "Schema of «Imports» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "importacoes"
            }
        },
        "/r/importacoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Imports"
                ],
                "operationId": "obterImportacoes",
                "summary": "Get Import",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_importacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "importacoes"
            }
        },
        "/r/incidentes_seguranca": {
            "get": {
                "tags": [
                    "Recurso: Security incidents"
                ],
                "operationId": "listarIncidentesSeguranca",
                "summary": "List Security incidents",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[gravidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Severity». List: a,b; range: f[gravidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[risco]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Risk to data subjects». List: a,b; range: f[risco][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[detetado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Detected on». List: a,b; range: f[detetado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[responsavel_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Person in charge». List: a,b; range: f[responsavel_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_incidentes_seguranca"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "incidentes_seguranca"
            },
            "post": {
                "tags": [
                    "Recurso: Security incidents"
                ],
                "operationId": "criarIncidentesSeguranca",
                "summary": "Create Incident",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_incidentes_seguranca_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_incidentes_seguranca_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_incidentes_seguranca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "incidentes_seguranca"
            }
        },
        "/r/incidentes_seguranca/esquema": {
            "get": {
                "tags": [
                    "Recurso: Security incidents"
                ],
                "operationId": "esquemaIncidentesSeguranca",
                "summary": "Schema of «Security incidents» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "incidentes_seguranca"
            }
        },
        "/r/incidentes_seguranca/{id}": {
            "get": {
                "tags": [
                    "Recurso: Security incidents"
                ],
                "operationId": "obterIncidentesSeguranca",
                "summary": "Get Incident",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_incidentes_seguranca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "incidentes_seguranca"
            },
            "put": {
                "tags": [
                    "Recurso: Security incidents"
                ],
                "operationId": "alterarIncidentesSeguranca",
                "summary": "Update Incident",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_incidentes_seguranca_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_incidentes_seguranca"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "incidentes_seguranca"
            },
            "delete": {
                "tags": [
                    "Recurso: Security incidents"
                ],
                "operationId": "apagarIncidentesSeguranca",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "incidentes_seguranca"
            }
        },
        "/r/incidentes_seguranca/{id}/acao/encerrar": {
            "post": {
                "tags": [
                    "Recurso: Security incidents"
                ],
                "operationId": "acaoEncerrarIncidentesSeguranca",
                "summary": "Action: Close",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "incidentes_seguranca"
            }
        },
        "/r/incidentes_seguranca/{id}/acao/notificar_cnpd": {
            "post": {
                "tags": [
                    "Recurso: Security incidents"
                ],
                "operationId": "acaoNotificarCnpdIncidentesSeguranca",
                "summary": "Action: Record notification to the CNPD",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "cnpd_referencia": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "CNPD reference",
                                        "maxLength": 60
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "incidentes_seguranca"
            }
        },
        "/r/incidentes_seguranca/{id}/acao/notificar_titulares": {
            "post": {
                "tags": [
                    "Recurso: Security incidents"
                ],
                "operationId": "acaoNotificarTitularesIncidentesSeguranca",
                "summary": "Action: Record information to data subjects",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "incidentes_seguranca"
            }
        },
        "/r/itinerarios": {
            "get": {
                "tags": [
                    "Recurso: Itineraries"
                ],
                "operationId": "listarItinerarios",
                "summary": "List Itineraries",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[chegada]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Arrival». List: a,b; range: f[chegada][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[interprete_idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Interpreter language». List: a,b; range: f[interprete_idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_itinerarios"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "itinerarios"
            },
            "post": {
                "tags": [
                    "Recurso: Itineraries"
                ],
                "operationId": "criarItinerarios",
                "summary": "Create Itinerary",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_itinerarios_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_itinerarios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_itinerarios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "itinerarios"
            }
        },
        "/r/itinerarios/esquema": {
            "get": {
                "tags": [
                    "Recurso: Itineraries"
                ],
                "operationId": "esquemaItinerarios",
                "summary": "Schema of «Itineraries» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "itinerarios"
            }
        },
        "/r/itinerarios/{id}": {
            "get": {
                "tags": [
                    "Recurso: Itineraries"
                ],
                "operationId": "obterItinerarios",
                "summary": "Get Itinerary",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_itinerarios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "itinerarios"
            },
            "put": {
                "tags": [
                    "Recurso: Itineraries"
                ],
                "operationId": "alterarItinerarios",
                "summary": "Update Itinerary",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_itinerarios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_itinerarios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "itinerarios"
            },
            "delete": {
                "tags": [
                    "Recurso: Itineraries"
                ],
                "operationId": "apagarItinerarios",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "itinerarios"
            }
        },
        "/r/leads": {
            "get": {
                "tags": [
                    "Recurso: Leads"
                ],
                "operationId": "listarLeads",
                "summary": "List Leads",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[procedimento_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Procedure of interest». List: a,b; range: f[procedimento_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Source». List: a,b; range: f[origem][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[campanha]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Campaign». List: a,b; range: f[campanha][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[funil_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Funnel». List: a,b; range: f[funil_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[fase_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Stage». List: a,b; range: f[fase_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[responsavel_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Owner». List: a,b; range: f[responsavel_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[decisao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Decision». List: a,b; range: f[decisao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[motivo_perda]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Loss reason». List: a,b; range: f[motivo_perda][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[duplicado_de]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Possible duplicate of». List: a,b; range: f[duplicado_de][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[criado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Received». List: a,b; range: f[criado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_leads"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "leads"
            },
            "post": {
                "tags": [
                    "Recurso: Leads"
                ],
                "operationId": "criarLeads",
                "summary": "Create Lead",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_leads_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_leads_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_leads"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "leads"
            }
        },
        "/r/leads/esquema": {
            "get": {
                "tags": [
                    "Recurso: Leads"
                ],
                "operationId": "esquemaLeads",
                "summary": "Schema of «Leads» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "leads"
            }
        },
        "/r/leads/{id}": {
            "get": {
                "tags": [
                    "Recurso: Leads"
                ],
                "operationId": "obterLeads",
                "summary": "Get Lead",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_leads"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "leads"
            },
            "put": {
                "tags": [
                    "Recurso: Leads"
                ],
                "operationId": "alterarLeads",
                "summary": "Update Lead",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_leads_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_leads"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "leads"
            },
            "delete": {
                "tags": [
                    "Recurso: Leads"
                ],
                "operationId": "apagarLeads",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "leads"
            }
        },
        "/r/leads/{id}/acao/converter": {
            "post": {
                "tags": [
                    "Recurso: Leads"
                ],
                "operationId": "acaoConverterLeads",
                "summary": "Action: Convert into patient",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "leads"
            }
        },
        "/r/leads/{id}/acao/fundir": {
            "post": {
                "tags": [
                    "Recurso: Leads"
                ],
                "operationId": "acaoFundirLeads",
                "summary": "Action: Merge with…",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "duplicado_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "title": "Lead to merge into this one",
                                        "x-anagen-recurso": "leads"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "leads"
            }
        },
        "/r/leads/{id}/acao/marcar_perdido": {
            "post": {
                "tags": [
                    "Recurso: Leads"
                ],
                "operationId": "acaoMarcarPerdidoLeads",
                "summary": "Action: Mark as lost",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo_perda": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Loss reason",
                                        "enum": [
                                            "preco",
                                            "prazo",
                                            "concorrencia",
                                            "nao_elegivel",
                                            "sem_resposta",
                                            "outro"
                                        ],
                                        "x-enum-rotulos": {
                                            "preco": "Price",
                                            "prazo": "Timing",
                                            "concorrencia": "Competitor",
                                            "nao_elegivel": "Not eligible",
                                            "sem_resposta": "No response",
                                            "outro": "Other"
                                        }
                                    },
                                    "motivo_perda_detalhe": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Loss reason details",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "leads"
            }
        },
        "/r/leads/{id}/acao/pedir_adesao": {
            "post": {
                "tags": [
                    "Recurso: Leads"
                ],
                "operationId": "acaoPedirAdesaoLeads",
                "summary": "Action: Request opt-in to communications",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "leads"
            }
        },
        "/r/lista_espera": {
            "get": {
                "tags": [
                    "Recurso: Waiting list"
                ],
                "operationId": "listarListaEspera",
                "summary": "List Waiting list",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Appointment type». List: a,b; range: f[tipo_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[profissional_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Preferred practitioner». List: a,b; range: f[profissional_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[prioridade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Priority». List: a,b; range: f[prioridade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_lista_espera"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "lista_espera"
            },
            "post": {
                "tags": [
                    "Recurso: Waiting list"
                ],
                "operationId": "criarListaEspera",
                "summary": "Create Waiting list entry",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_lista_espera_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_lista_espera_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_lista_espera"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "lista_espera"
            }
        },
        "/r/lista_espera/esquema": {
            "get": {
                "tags": [
                    "Recurso: Waiting list"
                ],
                "operationId": "esquemaListaEspera",
                "summary": "Schema of «Waiting list» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "lista_espera"
            }
        },
        "/r/lista_espera/{id}": {
            "get": {
                "tags": [
                    "Recurso: Waiting list"
                ],
                "operationId": "obterListaEspera",
                "summary": "Get Waiting list entry",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_lista_espera"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "lista_espera"
            },
            "put": {
                "tags": [
                    "Recurso: Waiting list"
                ],
                "operationId": "alterarListaEspera",
                "summary": "Update Waiting list entry",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_lista_espera_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_lista_espera"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "lista_espera"
            },
            "delete": {
                "tags": [
                    "Recurso: Waiting list"
                ],
                "operationId": "apagarListaEspera",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "lista_espera"
            }
        },
        "/r/lista_espera/{id}/acao/marcar": {
            "post": {
                "tags": [
                    "Recurso: Waiting list"
                ],
                "operationId": "acaoMarcarListaEspera",
                "summary": "Action: Book into a slot",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "lista_espera"
            }
        },
        "/r/lista_espera/{id}/acao/sair": {
            "post": {
                "tags": [
                    "Recurso: Waiting list"
                ],
                "operationId": "acaoSairListaEspera",
                "summary": "Action: Remove from list",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "lista_espera"
            }
        },
        "/r/locais": {
            "get": {
                "tags": [
                    "Recurso: Locations"
                ],
                "operationId": "listarLocais",
                "summary": "List Locations",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[localidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Town». List: a,b; range: f[localidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_locais"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "locais"
            },
            "post": {
                "tags": [
                    "Recurso: Locations"
                ],
                "operationId": "criarLocais",
                "summary": "Create Location",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_locais_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_locais_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_locais"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "locais"
            }
        },
        "/r/locais/esquema": {
            "get": {
                "tags": [
                    "Recurso: Locations"
                ],
                "operationId": "esquemaLocais",
                "summary": "Schema of «Locations» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "locais"
            }
        },
        "/r/locais/{id}": {
            "get": {
                "tags": [
                    "Recurso: Locations"
                ],
                "operationId": "obterLocais",
                "summary": "Get Location",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_locais"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "locais"
            },
            "put": {
                "tags": [
                    "Recurso: Locations"
                ],
                "operationId": "alterarLocais",
                "summary": "Update Location",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_locais_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_locais"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "locais"
            },
            "delete": {
                "tags": [
                    "Recurso: Locations"
                ],
                "operationId": "apagarLocais",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "locais"
            }
        },
        "/r/marcacao_tipos": {
            "get": {
                "tags": [
                    "Recurso: Appointment types"
                ],
                "operationId": "listarMarcacaoTipos",
                "summary": "List Appointment types",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[teleconsulta]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «By video (teleconsultation)». List: a,b; range: f[teleconsulta][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[cirurgia]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Surgical block». List: a,b; range: f[cirurgia][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[online]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Online booking». List: a,b; range: f[online][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_marcacao_tipos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcacao_tipos"
            },
            "post": {
                "tags": [
                    "Recurso: Appointment types"
                ],
                "operationId": "criarMarcacaoTipos",
                "summary": "Create Appointment type",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_marcacao_tipos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_marcacao_tipos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_marcacao_tipos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcacao_tipos"
            }
        },
        "/r/marcacao_tipos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Appointment types"
                ],
                "operationId": "esquemaMarcacaoTipos",
                "summary": "Schema of «Appointment types» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcacao_tipos"
            }
        },
        "/r/marcacao_tipos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Appointment types"
                ],
                "operationId": "obterMarcacaoTipos",
                "summary": "Get Appointment type",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_marcacao_tipos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcacao_tipos"
            },
            "put": {
                "tags": [
                    "Recurso: Appointment types"
                ],
                "operationId": "alterarMarcacaoTipos",
                "summary": "Update Appointment type",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_marcacao_tipos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_marcacao_tipos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcacao_tipos"
            },
            "delete": {
                "tags": [
                    "Recurso: Appointment types"
                ],
                "operationId": "apagarMarcacaoTipos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcacao_tipos"
            }
        },
        "/r/marcacoes": {
            "get": {
                "tags": [
                    "Recurso: Appointments"
                ],
                "operationId": "listarMarcacoes",
                "summary": "List Appointments",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[inicio]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Start». List: a,b; range: f[inicio][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[profissional_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Practitioner». List: a,b; range: f[profissional_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[sala_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Room». List: a,b; range: f[sala_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Source». List: a,b; range: f[origem][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_marcacoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcacoes"
            }
        },
        "/r/marcacoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Appointments"
                ],
                "operationId": "esquemaMarcacoes",
                "summary": "Schema of «Appointments» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcacoes"
            }
        },
        "/r/marcacoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Appointments"
                ],
                "operationId": "obterMarcacoes",
                "summary": "Get Appointment",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_marcacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcacoes"
            }
        },
        "/r/marcacoes/{id}/acao/cancelar": {
            "post": {
                "tags": [
                    "Recurso: Appointments"
                ],
                "operationId": "acaoCancelarMarcacoes",
                "summary": "Action: Cancel",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcacoes"
            }
        },
        "/r/marcacoes/{id}/acao/chegou": {
            "post": {
                "tags": [
                    "Recurso: Appointments"
                ],
                "operationId": "acaoChegouMarcacoes",
                "summary": "Action: Arrived",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcacoes"
            }
        },
        "/r/marcacoes/{id}/acao/concluir": {
            "post": {
                "tags": [
                    "Recurso: Appointments"
                ],
                "operationId": "acaoConcluirMarcacoes",
                "summary": "Action: Complete",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcacoes"
            }
        },
        "/r/marcacoes/{id}/acao/confirmar": {
            "post": {
                "tags": [
                    "Recurso: Appointments"
                ],
                "operationId": "acaoConfirmarMarcacoes",
                "summary": "Action: Confirm",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcacoes"
            }
        },
        "/r/marcacoes/{id}/acao/faltou": {
            "post": {
                "tags": [
                    "Recurso: Appointments"
                ],
                "operationId": "acaoFaltouMarcacoes",
                "summary": "Action: No-show",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcacoes"
            }
        },
        "/r/marcacoes/{id}/acao/lembrete": {
            "post": {
                "tags": [
                    "Recurso: Appointments"
                ],
                "operationId": "acaoLembreteMarcacoes",
                "summary": "Action: Send reminder",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcacoes"
            }
        },
        "/r/marcacoes/{id}/acao/remarcar": {
            "post": {
                "tags": [
                    "Recurso: Appointments"
                ],
                "operationId": "acaoRemarcarMarcacoes",
                "summary": "Action: Reschedule",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "inicio": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "title": "New date and time"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcacoes"
            }
        },
        "/r/marcos_acompanhamento": {
            "get": {
                "tags": [
                    "Recurso: Follow-up milestones"
                ],
                "operationId": "listarMarcosAcompanhamento",
                "summary": "List Follow-up milestones",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[marco]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Milestone». List: a,b; range: f[marco][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[data_prevista]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Expected date». List: a,b; range: f[data_prevista][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_marcos_acompanhamento"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcos_acompanhamento"
            },
            "post": {
                "tags": [
                    "Recurso: Follow-up milestones"
                ],
                "operationId": "criarMarcosAcompanhamento",
                "summary": "Create Follow-up milestone",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_marcos_acompanhamento_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_marcos_acompanhamento_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_marcos_acompanhamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcos_acompanhamento"
            }
        },
        "/r/marcos_acompanhamento/esquema": {
            "get": {
                "tags": [
                    "Recurso: Follow-up milestones"
                ],
                "operationId": "esquemaMarcosAcompanhamento",
                "summary": "Schema of «Follow-up milestones» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcos_acompanhamento"
            }
        },
        "/r/marcos_acompanhamento/{id}": {
            "get": {
                "tags": [
                    "Recurso: Follow-up milestones"
                ],
                "operationId": "obterMarcosAcompanhamento",
                "summary": "Get Follow-up milestone",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_marcos_acompanhamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "marcos_acompanhamento"
            },
            "put": {
                "tags": [
                    "Recurso: Follow-up milestones"
                ],
                "operationId": "alterarMarcosAcompanhamento",
                "summary": "Update Follow-up milestone",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_marcos_acompanhamento_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_marcos_acompanhamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcos_acompanhamento"
            },
            "delete": {
                "tags": [
                    "Recurso: Follow-up milestones"
                ],
                "operationId": "apagarMarcosAcompanhamento",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcos_acompanhamento"
            }
        },
        "/r/marcos_acompanhamento/{id}/acao/concluir": {
            "post": {
                "tags": [
                    "Recurso: Follow-up milestones"
                ],
                "operationId": "acaoConcluirMarcosAcompanhamento",
                "summary": "Action: Complete",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcos_acompanhamento"
            }
        },
        "/r/marcos_acompanhamento/{id}/acao/pedir_fotos": {
            "post": {
                "tags": [
                    "Recurso: Follow-up milestones"
                ],
                "operationId": "acaoPedirFotosMarcosAcompanhamento",
                "summary": "Action: Request photographs",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcos_acompanhamento"
            }
        },
        "/r/marcos_acompanhamento/{id}/acao/recuperacao": {
            "post": {
                "tags": [
                    "Recurso: Follow-up milestones"
                ],
                "operationId": "acaoRecuperacaoMarcosAcompanhamento",
                "summary": "Action: Recall task",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "nota": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Note for reception",
                                        "description": "No clinical details.",
                                        "maxLength": 500
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "marcos_acompanhamento"
            }
        },
        "/r/modelos3d": {
            "get": {
                "tags": [
                    "Recurso: 3D models"
                ],
                "operationId": "listarModelos3d",
                "summary": "List 3D models",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[formato]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Format». List: a,b; range: f[formato][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[escala_confirmada]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Scale confirmed». List: a,b; range: f[escala_confirmada][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[qualidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Quality». List: a,b; range: f[qualidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_modelos3d"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "modelos3d"
            },
            "post": {
                "tags": [
                    "Recurso: 3D models"
                ],
                "operationId": "criarModelos3d",
                "summary": "Create 3D model",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_modelos3d_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_modelos3d_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_modelos3d"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "modelos3d"
            }
        },
        "/r/modelos3d/esquema": {
            "get": {
                "tags": [
                    "Recurso: 3D models"
                ],
                "operationId": "esquemaModelos3d",
                "summary": "Schema of «3D models» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "modelos3d"
            }
        },
        "/r/modelos3d/{id}": {
            "get": {
                "tags": [
                    "Recurso: 3D models"
                ],
                "operationId": "obterModelos3d",
                "summary": "Get 3D model",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_modelos3d"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "modelos3d"
            },
            "put": {
                "tags": [
                    "Recurso: 3D models"
                ],
                "operationId": "alterarModelos3d",
                "summary": "Update 3D model",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_modelos3d_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_modelos3d"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "modelos3d"
            },
            "delete": {
                "tags": [
                    "Recurso: 3D models"
                ],
                "operationId": "apagarModelos3d",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "modelos3d"
            }
        },
        "/r/motor_versoes": {
            "get": {
                "tags": [
                    "Recurso: Engine versions"
                ],
                "operationId": "listarMotorVersoes",
                "summary": "List Engine versions",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_motor_versoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "motor_versoes"
            }
        },
        "/r/motor_versoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Engine versions"
                ],
                "operationId": "esquemaMotorVersoes",
                "summary": "Schema of «Engine versions» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "motor_versoes"
            }
        },
        "/r/motor_versoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Engine versions"
                ],
                "operationId": "obterMotorVersoes",
                "summary": "Get Engine version",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_motor_versoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "motor_versoes"
            },
            "delete": {
                "tags": [
                    "Recurso: Engine versions"
                ],
                "operationId": "apagarMotorVersoes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "motor_versoes"
            }
        },
        "/r/motor_versoes/{id}/acao/aprovar": {
            "post": {
                "tags": [
                    "Recurso: Engine versions"
                ],
                "operationId": "acaoAprovarMotorVersoes",
                "summary": "Action: Approve",
                "description": "Required level: aprovar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "aprovar",
                "x-anagen-recurso": "motor_versoes"
            }
        },
        "/r/motor_versoes/{id}/acao/arquivar": {
            "post": {
                "tags": [
                    "Recurso: Engine versions"
                ],
                "operationId": "acaoArquivarMotorVersoes",
                "summary": "Action: Archive",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "motor_versoes"
            }
        },
        "/r/motor_versoes/{id}/acao/novo_rascunho": {
            "post": {
                "tags": [
                    "Recurso: Engine versions"
                ],
                "operationId": "acaoNovoRascunhoMotorVersoes",
                "summary": "Action: New draft from this version",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "motor_versoes"
            }
        },
        "/r/objetivos_comerciais": {
            "get": {
                "tags": [
                    "Recurso: Sales goals"
                ],
                "operationId": "listarObjetivosComerciais",
                "summary": "List Sales goals",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[periodo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Month». List: a,b; range: f[periodo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[utilizador_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Person». List: a,b; range: f[utilizador_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[equipa_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Team». List: a,b; range: f[equipa_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[metrica]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Metric». List: a,b; range: f[metrica][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_objetivos_comerciais"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "objetivos_comerciais"
            },
            "post": {
                "tags": [
                    "Recurso: Sales goals"
                ],
                "operationId": "criarObjetivosComerciais",
                "summary": "Create Sales goal",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_objetivos_comerciais_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_objetivos_comerciais_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_objetivos_comerciais"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "objetivos_comerciais"
            }
        },
        "/r/objetivos_comerciais/esquema": {
            "get": {
                "tags": [
                    "Recurso: Sales goals"
                ],
                "operationId": "esquemaObjetivosComerciais",
                "summary": "Schema of «Sales goals» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "objetivos_comerciais"
            }
        },
        "/r/objetivos_comerciais/{id}": {
            "get": {
                "tags": [
                    "Recurso: Sales goals"
                ],
                "operationId": "obterObjetivosComerciais",
                "summary": "Get Sales goal",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_objetivos_comerciais"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "objetivos_comerciais"
            },
            "put": {
                "tags": [
                    "Recurso: Sales goals"
                ],
                "operationId": "alterarObjetivosComerciais",
                "summary": "Update Sales goal",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_objetivos_comerciais_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_objetivos_comerciais"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "objetivos_comerciais"
            },
            "delete": {
                "tags": [
                    "Recurso: Sales goals"
                ],
                "operationId": "apagarObjetivosComerciais",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "objetivos_comerciais"
            }
        },
        "/r/pacientes": {
            "get": {
                "tags": [
                    "Recurso: Patients"
                ],
                "operationId": "listarPacientes",
                "summary": "List Patients",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[sexo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Sex». List: a,b; range: f[sexo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[data_nascimento]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date of birth». List: a,b; range: f[data_nascimento][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[localidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Town / city». List: a,b; range: f[localidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[medico_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Attending physician». List: a,b; range: f[medico_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[responsavel_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Account manager». List: a,b; range: f[responsavel_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Source». List: a,b; range: f[origem][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[portal_ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient portal active». List: a,b; range: f[portal_ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[litigio]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «In dispute». List: a,b; range: f[litigio][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_pacientes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pacientes"
            },
            "post": {
                "tags": [
                    "Recurso: Patients"
                ],
                "operationId": "criarPacientes",
                "summary": "Create Patient",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_pacientes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_pacientes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pacientes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pacientes"
            }
        },
        "/r/pacientes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Patients"
                ],
                "operationId": "esquemaPacientes",
                "summary": "Schema of «Patients» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pacientes"
            }
        },
        "/r/pacientes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Patients"
                ],
                "operationId": "obterPacientes",
                "summary": "Get Patient",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pacientes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pacientes"
            },
            "put": {
                "tags": [
                    "Recurso: Patients"
                ],
                "operationId": "alterarPacientes",
                "summary": "Update Patient",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_pacientes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pacientes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pacientes"
            }
        },
        "/r/pacientes/{id}/acao/abrir_episodio": {
            "post": {
                "tags": [
                    "Recurso: Patients"
                ],
                "operationId": "acaoAbrirEpisodioPacientes",
                "summary": "Action: Open episode",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "procedimento_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "title": "Procedure",
                                        "x-anagen-recurso": "procedimentos"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pacientes"
            }
        },
        "/r/pacientes/{id}/acao/arquivar": {
            "post": {
                "tags": [
                    "Recurso: Patients"
                ],
                "operationId": "acaoArquivarPacientes",
                "summary": "Action: Archive",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pacientes"
            }
        },
        "/r/pacientes/{id}/acao/nova_consulta": {
            "post": {
                "tags": [
                    "Recurso: Patients"
                ],
                "operationId": "acaoNovaConsultaPacientes",
                "summary": "Action: New consultation",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tipo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Consultation type",
                                        "enum": [
                                            "primeira",
                                            "avaliacao",
                                            "controlo",
                                            "teleconsulta",
                                            "pre_operatoria"
                                        ],
                                        "x-enum-rotulos": {
                                            "primeira": "First consultation",
                                            "avaliacao": "Assessment",
                                            "controlo": "Follow-up",
                                            "teleconsulta": "Teleconsultation",
                                            "pre_operatoria": "Pre-operative"
                                        },
                                        "default": "primeira"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "pacientes"
            }
        },
        "/r/pacientes/{id}/acao/pedir_formulario": {
            "post": {
                "tags": [
                    "Recurso: Patients"
                ],
                "operationId": "acaoPedirFormularioPacientes",
                "summary": "Action: Request form",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "formulario_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "title": "Form",
                                        "x-anagen-recurso": "formularios"
                                    },
                                    "canal": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Channel",
                                        "enum": [
                                            "email",
                                            "sms",
                                            "whatsapp",
                                            "ligacao"
                                        ],
                                        "x-enum-rotulos": {
                                            "email": "Email",
                                            "sms": "SMS",
                                            "whatsapp": "WhatsApp",
                                            "ligacao": "Link only (share manually)"
                                        },
                                        "default": "email"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pacientes"
            }
        },
        "/r/pacientes/{id}/acao/reativar": {
            "post": {
                "tags": [
                    "Recurso: Patients"
                ],
                "operationId": "acaoReativarPacientes",
                "summary": "Action: Reactivate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pacientes"
            }
        },
        "/r/pacientes_alertas": {
            "get": {
                "tags": [
                    "Recurso: Clinical alerts"
                ],
                "operationId": "listarPacientesAlertas",
                "summary": "List Clinical alerts",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[gravidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Severity». List: a,b; range: f[gravidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[validado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Validated». List: a,b; range: f[validado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Source». List: a,b; range: f[origem][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_pacientes_alertas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pacientes_alertas"
            },
            "post": {
                "tags": [
                    "Recurso: Clinical alerts"
                ],
                "operationId": "criarPacientesAlertas",
                "summary": "Create Clinical alert",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_pacientes_alertas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_pacientes_alertas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pacientes_alertas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pacientes_alertas"
            }
        },
        "/r/pacientes_alertas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Clinical alerts"
                ],
                "operationId": "esquemaPacientesAlertas",
                "summary": "Schema of «Clinical alerts» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pacientes_alertas"
            }
        },
        "/r/pacientes_alertas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Clinical alerts"
                ],
                "operationId": "obterPacientesAlertas",
                "summary": "Get Clinical alert",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pacientes_alertas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pacientes_alertas"
            },
            "put": {
                "tags": [
                    "Recurso: Clinical alerts"
                ],
                "operationId": "alterarPacientesAlertas",
                "summary": "Update Clinical alert",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_pacientes_alertas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pacientes_alertas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pacientes_alertas"
            }
        },
        "/r/pacientes_alertas/{id}/acao/desativar": {
            "post": {
                "tags": [
                    "Recurso: Clinical alerts"
                ],
                "operationId": "acaoDesativarPacientesAlertas",
                "summary": "Action: Deactivate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pacientes_alertas"
            }
        },
        "/r/pacientes_alertas/{id}/acao/reativar": {
            "post": {
                "tags": [
                    "Recurso: Clinical alerts"
                ],
                "operationId": "acaoReativarPacientesAlertas",
                "summary": "Action: Reactivate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pacientes_alertas"
            }
        },
        "/r/pacientes_alertas/{id}/acao/validar": {
            "post": {
                "tags": [
                    "Recurso: Clinical alerts"
                ],
                "operationId": "acaoValidarPacientesAlertas",
                "summary": "Action: Validate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.clinica:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pacientes_alertas"
            }
        },
        "/r/pagamentos": {
            "get": {
                "tags": [
                    "Recurso: Payments"
                ],
                "operationId": "listarPagamentos",
                "summary": "List Payments",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[metodo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Method». List: a,b; range: f[metodo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[vence_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Due on». List: a,b; range: f[vence_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[pago_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Paid on». List: a,b; range: f[pago_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[confirmacao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Confirmation». List: a,b; range: f[confirmacao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[proposta_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Proposal». List: a,b; range: f[proposta_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[episodio_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Episode». List: a,b; range: f[episodio_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[caixa_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Till». List: a,b; range: f[caixa_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[local_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Location». List: a,b; range: f[local_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[conta_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Paying account». List: a,b; range: f[conta_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[convencao_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Agreement». List: a,b; range: f[convencao_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[terminal_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Terminal». List: a,b; range: f[terminal_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_pagamentos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pagamentos"
            }
        },
        "/r/pagamentos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Payments"
                ],
                "operationId": "esquemaPagamentos",
                "summary": "Schema of «Payments» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pagamentos"
            }
        },
        "/r/pagamentos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Payments"
                ],
                "operationId": "obterPagamentos",
                "summary": "Get Payment",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pagamentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pagamentos"
            },
            "put": {
                "tags": [
                    "Recurso: Payments"
                ],
                "operationId": "alterarPagamentos",
                "summary": "Update Payment",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_pagamentos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pagamentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pagamentos"
            }
        },
        "/r/pagamentos/{id}/acao/cancelar": {
            "post": {
                "tags": [
                    "Recurso: Payments"
                ],
                "operationId": "acaoCancelarPagamentos",
                "summary": "Action: Cancel",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pagamentos"
            }
        },
        "/r/pagamentos/{id}/acao/consultar_estado": {
            "post": {
                "tags": [
                    "Recurso: Payments"
                ],
                "operationId": "acaoConsultarEstadoPagamentos",
                "summary": "Action: Check status",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "pagamentos"
            }
        },
        "/r/pagamentos/{id}/acao/emitir_fatura": {
            "post": {
                "tags": [
                    "Recurso: Payments"
                ],
                "operationId": "acaoEmitirFaturaPagamentos",
                "summary": "Action: Issue tax document",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pagamentos"
            }
        },
        "/r/pagamentos/{id}/acao/marcar_pago": {
            "post": {
                "tags": [
                    "Recurso: Payments"
                ],
                "operationId": "acaoMarcarPagoPagamentos",
                "summary": "Action: Mark as paid",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "metodo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Method",
                                        "enum": [
                                            "numerario",
                                            "cartao",
                                            "transferencia",
                                            "financiamento"
                                        ],
                                        "x-enum-rotulos": {
                                            "numerario": "Cash",
                                            "cartao": "Card (terminal)",
                                            "transferencia": "Bank transfer",
                                            "financiamento": "Financing"
                                        }
                                    },
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Note (proof of payment, terminal)",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pagamentos"
            }
        },
        "/r/pagamentos/{id}/acao/reembolsar": {
            "post": {
                "tags": [
                    "Recurso: Payments"
                ],
                "operationId": "acaoReembolsarPagamentos",
                "summary": "Action: Refund",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pagamentos"
            }
        },
        "/r/parceiros": {
            "get": {
                "tags": [
                    "Recurso: Partners"
                ],
                "operationId": "listarParceiros",
                "summary": "List Partners",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[responsavel_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Clinic contact person». List: a,b; range: f[responsavel_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_parceiros"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "parceiros"
            }
        },
        "/r/parceiros/esquema": {
            "get": {
                "tags": [
                    "Recurso: Partners"
                ],
                "operationId": "esquemaParceiros",
                "summary": "Schema of «Partners» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "parceiros"
            }
        },
        "/r/parceiros/{id}": {
            "get": {
                "tags": [
                    "Recurso: Partners"
                ],
                "operationId": "obterParceiros",
                "summary": "Get Partner",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_parceiros"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "parceiros"
            },
            "put": {
                "tags": [
                    "Recurso: Partners"
                ],
                "operationId": "alterarParceiros",
                "summary": "Update Partner",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_parceiros_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_parceiros"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "parceiros"
            },
            "delete": {
                "tags": [
                    "Recurso: Partners"
                ],
                "operationId": "apagarParceiros",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "parceiros"
            }
        },
        "/r/parceiros/{id}/acao/aprovar": {
            "post": {
                "tags": [
                    "Recurso: Partners"
                ],
                "operationId": "acaoAprovarParceiros",
                "summary": "Action: Approve",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "parceiros"
            }
        },
        "/r/parceiros/{id}/acao/reativar": {
            "post": {
                "tags": [
                    "Recurso: Partners"
                ],
                "operationId": "acaoReativarParceiros",
                "summary": "Action: Reactivate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "parceiros"
            }
        },
        "/r/parceiros/{id}/acao/recusar": {
            "post": {
                "tags": [
                    "Recurso: Partners"
                ],
                "operationId": "acaoRecusarParceiros",
                "summary": "Action: Decline",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "parceiros"
            }
        },
        "/r/parceiros/{id}/acao/suspender": {
            "post": {
                "tags": [
                    "Recurso: Partners"
                ],
                "operationId": "acaoSuspenderParceiros",
                "summary": "Action: Suspend",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "parceiros"
            }
        },
        "/r/parceiros/{id}/acao/terminar_sessoes": {
            "post": {
                "tags": [
                    "Recurso: Partners"
                ],
                "operationId": "acaoTerminarSessoesParceiros",
                "summary": "Action: End sessions",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "parceiros"
            }
        },
        "/r/parceiros_encaminhamentos": {
            "get": {
                "tags": [
                    "Recurso: Partner referrals"
                ],
                "operationId": "listarParceirosEncaminhamentos",
                "summary": "List Partner referrals",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[parceiro_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Partner». List: a,b; range: f[parceiro_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado_manual]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status shown to the partner». List: a,b; range: f[estado_manual][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[criado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Received on». List: a,b; range: f[criado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_parceiros_encaminhamentos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "parceiros_encaminhamentos"
            }
        },
        "/r/parceiros_encaminhamentos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Partner referrals"
                ],
                "operationId": "esquemaParceirosEncaminhamentos",
                "summary": "Schema of «Partner referrals» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "parceiros_encaminhamentos"
            }
        },
        "/r/parceiros_encaminhamentos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Partner referrals"
                ],
                "operationId": "obterParceirosEncaminhamentos",
                "summary": "Get Referral",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_parceiros_encaminhamentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "parceiros_encaminhamentos"
            },
            "put": {
                "tags": [
                    "Recurso: Partner referrals"
                ],
                "operationId": "alterarParceirosEncaminhamentos",
                "summary": "Update Referral",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_parceiros_encaminhamentos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_parceiros_encaminhamentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "parceiros_encaminhamentos"
            },
            "delete": {
                "tags": [
                    "Recurso: Partner referrals"
                ],
                "operationId": "apagarParceirosEncaminhamentos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "parceiros_encaminhamentos"
            }
        },
        "/r/parceiros_encaminhamentos/{id}/acao/registar_autorizacao": {
            "post": {
                "tags": [
                    "Recurso: Partner referrals"
                ],
                "operationId": "acaoRegistarAutorizacaoParceirosEncaminhamentos",
                "summary": "Action: Record patient authorisation",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "origem": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "How it was given",
                                        "enum": [
                                            "presencial",
                                            "documento",
                                            "portal"
                                        ],
                                        "x-enum-rotulos": {
                                            "presencial": "Given in person",
                                            "documento": "Signed document",
                                            "portal": "In the patient portal"
                                        },
                                        "default": "documento"
                                    },
                                    "valida_ate": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "title": "Valid until"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "parceiros_encaminhamentos"
            }
        },
        "/r/parceiros_encaminhamentos/{id}/acao/revogar_autorizacao": {
            "post": {
                "tags": [
                    "Recurso: Partner referrals"
                ],
                "operationId": "acaoRevogarAutorizacaoParceirosEncaminhamentos",
                "summary": "Action: Revoke authorisation",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "parceiros_encaminhamentos"
            }
        },
        "/r/pedidos_titulares": {
            "get": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "listarPedidosTitulares",
                "summary": "List Data subject requests",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Request». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[recebido_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Received on». List: a,b; range: f[recebido_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[prazo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Deadline». List: a,b; range: f[prazo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tratado_por]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Handled by». List: a,b; range: f[tratado_por][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_pedidos_titulares"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pedidos_titulares"
            },
            "post": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "criarPedidosTitulares",
                "summary": "Create Data subject request",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_pedidos_titulares_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_pedidos_titulares_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pedidos_titulares"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pedidos_titulares"
            }
        },
        "/r/pedidos_titulares/esquema": {
            "get": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "esquemaPedidosTitulares",
                "summary": "Schema of «Data subject requests» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pedidos_titulares"
            }
        },
        "/r/pedidos_titulares/{id}": {
            "get": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "obterPedidosTitulares",
                "summary": "Get Data subject request",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pedidos_titulares"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pedidos_titulares"
            },
            "put": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "alterarPedidosTitulares",
                "summary": "Update Data subject request",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_pedidos_titulares_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pedidos_titulares"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pedidos_titulares"
            },
            "delete": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "apagarPedidosTitulares",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pedidos_titulares"
            }
        },
        "/r/pedidos_titulares/{id}/acao/aplicar_apagamento": {
            "post": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "acaoAplicarApagamentoPedidosTitulares",
                "summary": "Action: Apply erasure",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pedidos_titulares"
            }
        },
        "/r/pedidos_titulares/{id}/acao/em_analise": {
            "post": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "acaoEmAnalisePedidosTitulares",
                "summary": "Action: Mark as under review",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "identidade_verificada": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ],
                                        "title": "Identity verified"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pedidos_titulares"
            }
        },
        "/r/pedidos_titulares/{id}/acao/exportar_dados": {
            "post": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "acaoExportarDadosPedidosTitulares",
                "summary": "Action: Export data",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pedidos_titulares"
            }
        },
        "/r/pedidos_titulares/{id}/acao/prorrogar": {
            "post": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "acaoProrrogarPedidosTitulares",
                "summary": "Action: Extend deadline",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason for extension",
                                        "maxLength": 500
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pedidos_titulares"
            }
        },
        "/r/pedidos_titulares/{id}/acao/responder": {
            "post": {
                "tags": [
                    "Recurso: Data subject requests"
                ],
                "operationId": "acaoResponderPedidosTitulares",
                "summary": "Action: Respond",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "estado": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Decision",
                                        "enum": [
                                            "concluido",
                                            "recusado"
                                        ],
                                        "x-enum-rotulos": {
                                            "concluido": "Completed",
                                            "recusado": "Refused"
                                        }
                                    },
                                    "resposta": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Response",
                                        "maxLength": 10000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pedidos_titulares"
            }
        },
        "/r/perfis": {
            "get": {
                "tags": [
                    "Recurso: Profiles"
                ],
                "operationId": "listarPerfis",
                "summary": "List Profiles",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[departamento]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Family». List: a,b; range: f[departamento][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_perfis"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "perfis"
            }
        },
        "/r/perfis/esquema": {
            "get": {
                "tags": [
                    "Recurso: Profiles"
                ],
                "operationId": "esquemaPerfis",
                "summary": "Schema of «Profiles» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "perfis"
            }
        },
        "/r/perfis/{id}": {
            "get": {
                "tags": [
                    "Recurso: Profiles"
                ],
                "operationId": "obterPerfis",
                "summary": "Get Profile",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_perfis"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "perfis"
            }
        },
        "/r/planos": {
            "get": {
                "tags": [
                    "Recurso: Surgical plans"
                ],
                "operationId": "listarPlanos",
                "summary": "List Surgical plans",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tecnica]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Technique». List: a,b; range: f[tecnica][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_planos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "planos"
            }
        },
        "/r/planos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Surgical plans"
                ],
                "operationId": "esquemaPlanos",
                "summary": "Schema of «Surgical plans» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "planos"
            }
        },
        "/r/planos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Surgical plans"
                ],
                "operationId": "obterPlanos",
                "summary": "Get Surgical plan",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_planos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "planos"
            },
            "delete": {
                "tags": [
                    "Recurso: Surgical plans"
                ],
                "operationId": "apagarPlanos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "planos"
            }
        },
        "/r/planos/{id}/acao/aprovar": {
            "post": {
                "tags": [
                    "Recurso: Surgical plans"
                ],
                "operationId": "acaoAprovarPlanos",
                "summary": "Action: Approve",
                "description": "Required level: aprovar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "aprovar",
                "x-anagen-recurso": "planos"
            }
        },
        "/r/planos/{id}/acao/nova_versao": {
            "post": {
                "tags": [
                    "Recurso: Surgical plans"
                ],
                "operationId": "acaoNovaVersaoPlanos",
                "summary": "Action: New version",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "planos"
            }
        },
        "/r/planos/{id}/acao/submeter": {
            "post": {
                "tags": [
                    "Recurso: Surgical plans"
                ],
                "operationId": "acaoSubmeterPlanos",
                "summary": "Action: Submit for review",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "planos"
            }
        },
        "/r/portal_contas": {
            "get": {
                "tags": [
                    "Recurso: Portal accounts"
                ],
                "operationId": "listarPortalContas",
                "summary": "List Portal accounts",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_portal_contas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "portal_contas"
            },
            "post": {
                "tags": [
                    "Recurso: Portal accounts"
                ],
                "operationId": "criarPortalContas",
                "summary": "Create Portal account",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_portal_contas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_portal_contas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_portal_contas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "portal_contas"
            }
        },
        "/r/portal_contas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Portal accounts"
                ],
                "operationId": "esquemaPortalContas",
                "summary": "Schema of «Portal accounts» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "portal_contas"
            }
        },
        "/r/portal_contas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Portal accounts"
                ],
                "operationId": "obterPortalContas",
                "summary": "Get Portal account",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_portal_contas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "portal_contas"
            }
        },
        "/r/portal_contas/{id}/acao/reativar": {
            "post": {
                "tags": [
                    "Recurso: Portal accounts"
                ],
                "operationId": "acaoReativarPortalContas",
                "summary": "Action: Reactivate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "portal_contas"
            }
        },
        "/r/portal_contas/{id}/acao/suspender": {
            "post": {
                "tags": [
                    "Recurso: Portal accounts"
                ],
                "operationId": "acaoSuspenderPortalContas",
                "summary": "Action: Suspend",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "portal_contas"
            }
        },
        "/r/portal_contas/{id}/acao/terminar": {
            "post": {
                "tags": [
                    "Recurso: Portal accounts"
                ],
                "operationId": "acaoTerminarPortalContas",
                "summary": "Action: End sessions",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "portal_contas"
            }
        },
        "/r/portal_pedidos": {
            "get": {
                "tags": [
                    "Recurso: Portal requests"
                ],
                "operationId": "listarPortalPedidos",
                "summary": "List Portal requests",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[prazo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Legal deadline». List: a,b; range: f[prazo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_portal_pedidos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "portal_pedidos"
            }
        },
        "/r/portal_pedidos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Portal requests"
                ],
                "operationId": "esquemaPortalPedidos",
                "summary": "Schema of «Portal requests» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "portal_pedidos"
            }
        },
        "/r/portal_pedidos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Portal requests"
                ],
                "operationId": "obterPortalPedidos",
                "summary": "Get Portal request",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_portal_pedidos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "portal_pedidos"
            }
        },
        "/r/portal_pedidos/{id}/acao/aceitar": {
            "post": {
                "tags": [
                    "Recurso: Portal requests"
                ],
                "operationId": "acaoAceitarPortalPedidos",
                "summary": "Action: Accept and apply",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "portal_pedidos"
            }
        },
        "/r/portal_pedidos/{id}/acao/analisar": {
            "post": {
                "tags": [
                    "Recurso: Portal requests"
                ],
                "operationId": "acaoAnalisarPortalPedidos",
                "summary": "Action: Mark under review",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "portal_pedidos"
            }
        },
        "/r/portal_pedidos/{id}/acao/concluir": {
            "post": {
                "tags": [
                    "Recurso: Portal requests"
                ],
                "operationId": "acaoConcluirPortalPedidos",
                "summary": "Action: Complete and reply",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "resposta": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reply to the patient",
                                        "maxLength": 5000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "portal_pedidos"
            }
        },
        "/r/portal_pedidos/{id}/acao/recusar": {
            "post": {
                "tags": [
                    "Recurso: Portal requests"
                ],
                "operationId": "acaoRecusarPortalPedidos",
                "summary": "Action: Decline",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.identificacao:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 2000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "portal_pedidos"
            }
        },
        "/r/pre_avaliacoes": {
            "get": {
                "tags": [
                    "Recurso: Online assessments"
                ],
                "operationId": "listarPreAvaliacoes",
                "summary": "List Online assessments",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[procedimento]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Area of interest». List: a,b; range: f[procedimento][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Source». List: a,b; range: f[origem][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[parecer]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Medical opinion». List: a,b; range: f[parecer][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[criado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Received on». List: a,b; range: f[criado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_pre_avaliacoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pre_avaliacoes"
            }
        },
        "/r/pre_avaliacoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Online assessments"
                ],
                "operationId": "esquemaPreAvaliacoes",
                "summary": "Schema of «Online assessments» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pre_avaliacoes"
            }
        },
        "/r/pre_avaliacoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Online assessments"
                ],
                "operationId": "obterPreAvaliacoes",
                "summary": "Get Online assessment",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_pre_avaliacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "pre_avaliacoes"
            }
        },
        "/r/pre_avaliacoes/{id}/acao/abrir_lead": {
            "post": {
                "tags": [
                    "Recurso: Online assessments"
                ],
                "operationId": "acaoAbrirLeadPreAvaliacoes",
                "summary": "Action: Open lead",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "pre_avaliacoes"
            }
        },
        "/r/pre_avaliacoes/{id}/acao/enviar_resposta": {
            "post": {
                "tags": [
                    "Recurso: Online assessments"
                ],
                "operationId": "acaoEnviarRespostaPreAvaliacoes",
                "summary": "Action: Send reply",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "mensagem": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Additional message",
                                        "description": "Optional. No clinical details.",
                                        "maxLength": 2000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "pre_avaliacoes"
            }
        },
        "/r/pre_avaliacoes/{id}/acao/marcar_revista": {
            "post": {
                "tags": [
                    "Recurso: Online assessments"
                ],
                "operationId": "acaoMarcarRevistaPreAvaliacoes",
                "summary": "Action: Mark as reviewed",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "parecer": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Medical opinion",
                                        "enum": [
                                            "consulta",
                                            "teleconsulta",
                                            "mais_fotos",
                                            "nao_elegivel",
                                            "outro"
                                        ],
                                        "x-enum-rotulos": {
                                            "consulta": "Book an in-person consultation",
                                            "teleconsulta": "Book a video consultation",
                                            "mais_fotos": "Ask for more photographs",
                                            "nao_elegivel": "Talk about other options",
                                            "outro": "Other (team contact)"
                                        }
                                    },
                                    "nota": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Medical note (internal)",
                                        "maxLength": 4000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "pre_avaliacoes"
            }
        },
        "/r/pre_avaliacoes/{id}/acao/rever": {
            "post": {
                "tags": [
                    "Recurso: Online assessments"
                ],
                "operationId": "acaoReverPreAvaliacoes",
                "summary": "Action: Open review",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "pre_avaliacoes"
            }
        },
        "/r/procedimentos": {
            "get": {
                "tags": [
                    "Recurso: Procedures"
                ],
                "operationId": "listarProcedimentos",
                "summary": "List Procedures",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tecnica]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Technique». List: a,b; range: f[tecnica][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[area]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Area». List: a,b; range: f[area][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[iva_validado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Validated by the accountant». List: a,b; range: f[iva_validado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_procedimentos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "procedimentos"
            },
            "post": {
                "tags": [
                    "Recurso: Procedures"
                ],
                "operationId": "criarProcedimentos",
                "summary": "Create Procedure",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_procedimentos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_procedimentos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_procedimentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "procedimentos"
            }
        },
        "/r/procedimentos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Procedures"
                ],
                "operationId": "esquemaProcedimentos",
                "summary": "Schema of «Procedures» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "procedimentos"
            }
        },
        "/r/procedimentos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Procedures"
                ],
                "operationId": "obterProcedimentos",
                "summary": "Get Procedure",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_procedimentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "procedimentos"
            },
            "put": {
                "tags": [
                    "Recurso: Procedures"
                ],
                "operationId": "alterarProcedimentos",
                "summary": "Update Procedure",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_procedimentos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_procedimentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "procedimentos"
            },
            "delete": {
                "tags": [
                    "Recurso: Procedures"
                ],
                "operationId": "apagarProcedimentos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "procedimentos"
            }
        },
        "/r/propostas": {
            "get": {
                "tags": [
                    "Recurso: Proposals"
                ],
                "operationId": "listarPropostas",
                "summary": "List Proposals",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[lead_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Contact». List: a,b; range: f[lead_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[procedimento_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Procedure». List: a,b; range: f[procedimento_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[moeda]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Currency». List: a,b; range: f[moeda][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[desconto_estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Discount». List: a,b; range: f[desconto_estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[validade_ate]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Valid until». List: a,b; range: f[validade_ate][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[enviada_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Sent on». List: a,b; range: f[enviada_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[aceite_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Accepted on». List: a,b; range: f[aceite_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[responsavel_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Owner». List: a,b; range: f[responsavel_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_propostas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "propostas"
            }
        },
        "/r/propostas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Proposals"
                ],
                "operationId": "esquemaPropostas",
                "summary": "Schema of «Proposals» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "propostas"
            }
        },
        "/r/propostas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Proposals"
                ],
                "operationId": "obterPropostas",
                "summary": "Get Proposal",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_propostas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "propostas"
            },
            "delete": {
                "tags": [
                    "Recurso: Proposals"
                ],
                "operationId": "apagarPropostas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "comercial.propostas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "propostas"
            }
        },
        "/r/protocolos_foto": {
            "get": {
                "tags": [
                    "Recurso: Photo protocols"
                ],
                "operationId": "listarProtocolosFoto",
                "summary": "List Photo protocols",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[marco]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Milestone». List: a,b; range: f[marco][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_protocolos_foto"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "protocolos_foto"
            },
            "post": {
                "tags": [
                    "Recurso: Photo protocols"
                ],
                "operationId": "criarProtocolosFoto",
                "summary": "Create Photo protocol",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_protocolos_foto_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_protocolos_foto_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_protocolos_foto"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "protocolos_foto"
            }
        },
        "/r/protocolos_foto/esquema": {
            "get": {
                "tags": [
                    "Recurso: Photo protocols"
                ],
                "operationId": "esquemaProtocolosFoto",
                "summary": "Schema of «Photo protocols» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "protocolos_foto"
            }
        },
        "/r/protocolos_foto/{id}": {
            "get": {
                "tags": [
                    "Recurso: Photo protocols"
                ],
                "operationId": "obterProtocolosFoto",
                "summary": "Get Photo protocol",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_protocolos_foto"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "protocolos_foto"
            },
            "put": {
                "tags": [
                    "Recurso: Photo protocols"
                ],
                "operationId": "alterarProtocolosFoto",
                "summary": "Update Photo protocol",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_protocolos_foto_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_protocolos_foto"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "protocolos_foto"
            },
            "delete": {
                "tags": [
                    "Recurso: Photo protocols"
                ],
                "operationId": "apagarProtocolosFoto",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "protocolos_foto"
            }
        },
        "/r/publicos_anuncios": {
            "get": {
                "tags": [
                    "Recurso: Ad audiences"
                ],
                "operationId": "listarPublicosAnuncios",
                "summary": "List Ad audiences",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[plataforma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Destination». List: a,b; range: f[plataforma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_publicos_anuncios"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "publicos_anuncios"
            },
            "post": {
                "tags": [
                    "Recurso: Ad audiences"
                ],
                "operationId": "criarPublicosAnuncios",
                "summary": "Create Audience",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_publicos_anuncios_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_publicos_anuncios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_publicos_anuncios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "publicos_anuncios"
            }
        },
        "/r/publicos_anuncios/esquema": {
            "get": {
                "tags": [
                    "Recurso: Ad audiences"
                ],
                "operationId": "esquemaPublicosAnuncios",
                "summary": "Schema of «Ad audiences» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "publicos_anuncios"
            }
        },
        "/r/publicos_anuncios/{id}": {
            "get": {
                "tags": [
                    "Recurso: Ad audiences"
                ],
                "operationId": "obterPublicosAnuncios",
                "summary": "Get Audience",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_publicos_anuncios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "publicos_anuncios"
            },
            "put": {
                "tags": [
                    "Recurso: Ad audiences"
                ],
                "operationId": "alterarPublicosAnuncios",
                "summary": "Update Audience",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_publicos_anuncios_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_publicos_anuncios"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "publicos_anuncios"
            },
            "delete": {
                "tags": [
                    "Recurso: Ad audiences"
                ],
                "operationId": "apagarPublicosAnuncios",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "publicos_anuncios"
            }
        },
        "/r/publicos_anuncios/{id}/acao/enviar": {
            "post": {
                "tags": [
                    "Recurso: Ad audiences"
                ],
                "operationId": "acaoEnviarPublicosAnuncios",
                "summary": "Action: Send now",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "publicos_anuncios"
            }
        },
        "/r/reclamacoes": {
            "get": {
                "tags": [
                    "Recurso: Complaints, compliments and suggestions"
                ],
                "operationId": "listarReclamacoes",
                "summary": "List Complaints, compliments and suggestions",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[categoria]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Category». List: a,b; range: f[categoria][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[recebida_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Received on». List: a,b; range: f[recebida_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[prazo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Deadline». List: a,b; range: f[prazo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[responsavel_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Person in charge». List: a,b; range: f[responsavel_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[exportada_ers_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Exported to the ERS on». List: a,b; range: f[exportada_ers_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_reclamacoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "reclamacoes"
            },
            "post": {
                "tags": [
                    "Recurso: Complaints, compliments and suggestions"
                ],
                "operationId": "criarReclamacoes",
                "summary": "Create Complaint",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_reclamacoes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_reclamacoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_reclamacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reclamacoes"
            }
        },
        "/r/reclamacoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Complaints, compliments and suggestions"
                ],
                "operationId": "esquemaReclamacoes",
                "summary": "Schema of «Complaints, compliments and suggestions» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "reclamacoes"
            }
        },
        "/r/reclamacoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Complaints, compliments and suggestions"
                ],
                "operationId": "obterReclamacoes",
                "summary": "Get Complaint",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_reclamacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "reclamacoes"
            },
            "put": {
                "tags": [
                    "Recurso: Complaints, compliments and suggestions"
                ],
                "operationId": "alterarReclamacoes",
                "summary": "Update Complaint",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_reclamacoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_reclamacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reclamacoes"
            },
            "delete": {
                "tags": [
                    "Recurso: Complaints, compliments and suggestions"
                ],
                "operationId": "apagarReclamacoes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reclamacoes"
            }
        },
        "/r/reclamacoes/{id}/acao/encerrar": {
            "post": {
                "tags": [
                    "Recurso: Complaints, compliments and suggestions"
                ],
                "operationId": "acaoEncerrarReclamacoes",
                "summary": "Action: Close",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reclamacoes"
            }
        },
        "/r/reclamacoes/{id}/acao/responder": {
            "post": {
                "tags": [
                    "Recurso: Complaints, compliments and suggestions"
                ],
                "operationId": "acaoResponderReclamacoes",
                "summary": "Action: Respond",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "resposta": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Response",
                                        "maxLength": 10000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reclamacoes"
            }
        },
        "/r/reclamacoes/{id}/acao/tratar": {
            "post": {
                "tags": [
                    "Recurso: Complaints, compliments and suggestions"
                ],
                "operationId": "acaoTratarReclamacoes",
                "summary": "Action: Start handling",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reclamacoes"
            }
        },
        "/r/recursos_agenda": {
            "get": {
                "tags": [
                    "Recurso: Rooms, equipment and interpreters"
                ],
                "operationId": "listarRecursosAgenda",
                "summary": "List Rooms, equipment and interpreters",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[bloco]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Operating theatre». List: a,b; range: f[bloco][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_recursos_agenda"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "recursos_agenda"
            },
            "post": {
                "tags": [
                    "Recurso: Rooms, equipment and interpreters"
                ],
                "operationId": "criarRecursosAgenda",
                "summary": "Create Schedule resource",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_recursos_agenda_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_recursos_agenda_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_recursos_agenda"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "recursos_agenda"
            }
        },
        "/r/recursos_agenda/esquema": {
            "get": {
                "tags": [
                    "Recurso: Rooms, equipment and interpreters"
                ],
                "operationId": "esquemaRecursosAgenda",
                "summary": "Schema of «Rooms, equipment and interpreters» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "recursos_agenda"
            }
        },
        "/r/recursos_agenda/{id}": {
            "get": {
                "tags": [
                    "Recurso: Rooms, equipment and interpreters"
                ],
                "operationId": "obterRecursosAgenda",
                "summary": "Get Schedule resource",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_recursos_agenda"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "recursos_agenda"
            },
            "put": {
                "tags": [
                    "Recurso: Rooms, equipment and interpreters"
                ],
                "operationId": "alterarRecursosAgenda",
                "summary": "Update Schedule resource",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_recursos_agenda_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_recursos_agenda"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "recursos_agenda"
            },
            "delete": {
                "tags": [
                    "Recurso: Rooms, equipment and interpreters"
                ],
                "operationId": "apagarRecursosAgenda",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "agenda:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "recursos_agenda"
            }
        },
        "/r/regras_elegibilidade": {
            "get": {
                "tags": [
                    "Recurso: Eligibility rules"
                ],
                "operationId": "listarRegrasElegibilidade",
                "summary": "List Eligibility rules",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[nivel]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Level». List: a,b; range: f[nivel][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_regras_elegibilidade"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "regras_elegibilidade"
            },
            "post": {
                "tags": [
                    "Recurso: Eligibility rules"
                ],
                "operationId": "criarRegrasElegibilidade",
                "summary": "Create Eligibility rule",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_regras_elegibilidade_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_regras_elegibilidade_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_regras_elegibilidade"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "regras_elegibilidade"
            }
        },
        "/r/regras_elegibilidade/esquema": {
            "get": {
                "tags": [
                    "Recurso: Eligibility rules"
                ],
                "operationId": "esquemaRegrasElegibilidade",
                "summary": "Schema of «Eligibility rules» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "regras_elegibilidade"
            }
        },
        "/r/regras_elegibilidade/{id}": {
            "get": {
                "tags": [
                    "Recurso: Eligibility rules"
                ],
                "operationId": "obterRegrasElegibilidade",
                "summary": "Get Eligibility rule",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_regras_elegibilidade"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "regras_elegibilidade"
            },
            "put": {
                "tags": [
                    "Recurso: Eligibility rules"
                ],
                "operationId": "alterarRegrasElegibilidade",
                "summary": "Update Eligibility rule",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_regras_elegibilidade_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_regras_elegibilidade"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "regras_elegibilidade"
            },
            "delete": {
                "tags": [
                    "Recurso: Eligibility rules"
                ],
                "operationId": "apagarRegrasElegibilidade",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "regras_elegibilidade"
            }
        },
        "/r/regras_elegibilidade/{id}/acao/alternar": {
            "post": {
                "tags": [
                    "Recurso: Eligibility rules"
                ],
                "operationId": "acaoAlternarRegrasElegibilidade",
                "summary": "Action: Activate / deactivate",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "regras_elegibilidade"
            }
        },
        "/r/regras_elegibilidade/{id}/acao/aprovar": {
            "post": {
                "tags": [
                    "Recurso: Eligibility rules"
                ],
                "operationId": "acaoAprovarRegrasElegibilidade",
                "summary": "Action: Approve rule",
                "description": "Required level: aprovar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "aprovar",
                "x-anagen-recurso": "regras_elegibilidade"
            }
        },
        "/r/regras_elegibilidade/{id}/acao/arquivar": {
            "post": {
                "tags": [
                    "Recurso: Eligibility rules"
                ],
                "operationId": "acaoArquivarRegrasElegibilidade",
                "summary": "Action: Archive",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "clinico.parametros:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "regras_elegibilidade"
            }
        },
        "/r/relatorios_agendados": {
            "get": {
                "tags": [
                    "Recurso: Scheduled reports"
                ],
                "operationId": "listarRelatoriosAgendados",
                "summary": "List Scheduled reports",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[periodicidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Frequency». List: a,b; range: f[periodicidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_relatorios_agendados"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "relatorios_agendados"
            },
            "post": {
                "tags": [
                    "Recurso: Scheduled reports"
                ],
                "operationId": "criarRelatoriosAgendados",
                "summary": "Create Scheduled report",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_relatorios_agendados_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_relatorios_agendados_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_relatorios_agendados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "relatorios_agendados"
            }
        },
        "/r/relatorios_agendados/esquema": {
            "get": {
                "tags": [
                    "Recurso: Scheduled reports"
                ],
                "operationId": "esquemaRelatoriosAgendados",
                "summary": "Schema of «Scheduled reports» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "relatorios_agendados"
            }
        },
        "/r/relatorios_agendados/{id}": {
            "get": {
                "tags": [
                    "Recurso: Scheduled reports"
                ],
                "operationId": "obterRelatoriosAgendados",
                "summary": "Get Scheduled report",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_relatorios_agendados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "relatorios_agendados"
            },
            "put": {
                "tags": [
                    "Recurso: Scheduled reports"
                ],
                "operationId": "alterarRelatoriosAgendados",
                "summary": "Update Scheduled report",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_relatorios_agendados_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_relatorios_agendados"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "relatorios_agendados"
            },
            "delete": {
                "tags": [
                    "Recurso: Scheduled reports"
                ],
                "operationId": "apagarRelatoriosAgendados",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "relatorios_agendados"
            }
        },
        "/r/relatorios_agendados/{id}/acao/enviar_agora": {
            "post": {
                "tags": [
                    "Recurso: Scheduled reports"
                ],
                "operationId": "acaoEnviarAgoraRelatoriosAgendados",
                "summary": "Action: Send now",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "relatorios_agendados"
            }
        },
        "/r/respostas_rapidas": {
            "get": {
                "tags": [
                    "Recurso: Quick replies"
                ],
                "operationId": "listarRespostasRapidas",
                "summary": "List Quick replies",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[idioma]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[idioma][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_respostas_rapidas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "respostas_rapidas"
            },
            "post": {
                "tags": [
                    "Recurso: Quick replies"
                ],
                "operationId": "criarRespostasRapidas",
                "summary": "Create Quick reply",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_respostas_rapidas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_respostas_rapidas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_respostas_rapidas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "respostas_rapidas"
            }
        },
        "/r/respostas_rapidas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Quick replies"
                ],
                "operationId": "esquemaRespostasRapidas",
                "summary": "Schema of «Quick replies» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "respostas_rapidas"
            }
        },
        "/r/respostas_rapidas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Quick replies"
                ],
                "operationId": "obterRespostasRapidas",
                "summary": "Get Quick reply",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_respostas_rapidas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "respostas_rapidas"
            },
            "put": {
                "tags": [
                    "Recurso: Quick replies"
                ],
                "operationId": "alterarRespostasRapidas",
                "summary": "Update Quick reply",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_respostas_rapidas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_respostas_rapidas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "respostas_rapidas"
            },
            "delete": {
                "tags": [
                    "Recurso: Quick replies"
                ],
                "operationId": "apagarRespostasRapidas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.atendimento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "respostas_rapidas"
            }
        },
        "/r/reunioes": {
            "get": {
                "tags": [
                    "Recurso: Meetings"
                ],
                "operationId": "listarReunioes",
                "summary": "List Meetings",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[inicio]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Start». List: a,b; range: f[inicio][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_reunioes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "reunioes"
            },
            "post": {
                "tags": [
                    "Recurso: Meetings"
                ],
                "operationId": "criarReunioes",
                "summary": "Create Meeting",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_reunioes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_reunioes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_reunioes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reunioes"
            }
        },
        "/r/reunioes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Meetings"
                ],
                "operationId": "esquemaReunioes",
                "summary": "Schema of «Meetings» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "reunioes"
            }
        },
        "/r/reunioes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Meetings"
                ],
                "operationId": "obterReunioes",
                "summary": "Get Meeting",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_reunioes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "reunioes"
            },
            "put": {
                "tags": [
                    "Recurso: Meetings"
                ],
                "operationId": "alterarReunioes",
                "summary": "Update Meeting",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_reunioes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_reunioes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reunioes"
            },
            "delete": {
                "tags": [
                    "Recurso: Meetings"
                ],
                "operationId": "apagarReunioes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reunioes"
            }
        },
        "/r/reunioes/{id}/acao/cancelar": {
            "post": {
                "tags": [
                    "Recurso: Meetings"
                ],
                "operationId": "acaoCancelarReunioes",
                "summary": "Action: Cancel",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reunioes"
            }
        },
        "/r/reunioes/{id}/acao/iniciar": {
            "post": {
                "tags": [
                    "Recurso: Meetings"
                ],
                "operationId": "acaoIniciarReunioes",
                "summary": "Action: Start",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reunioes"
            }
        },
        "/r/reunioes/{id}/acao/resumir": {
            "post": {
                "tags": [
                    "Recurso: Meetings"
                ],
                "operationId": "acaoResumirReunioes",
                "summary": "Action: Suggest a summary of the notes",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reunioes"
            }
        },
        "/r/reunioes/{id}/acao/terminar": {
            "post": {
                "tags": [
                    "Recurso: Meetings"
                ],
                "operationId": "acaoTerminarReunioes",
                "summary": "Action: End",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.chat:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "reunioes"
            }
        },
        "/r/revisoes_acessos": {
            "get": {
                "tags": [
                    "Recurso: Access reviews"
                ],
                "operationId": "listarRevisoesAcessos",
                "summary": "List Access reviews",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[periodo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Quarter». List: a,b; range: f[periodo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_revisoes_acessos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "revisoes_acessos"
            }
        },
        "/r/revisoes_acessos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Access reviews"
                ],
                "operationId": "esquemaRevisoesAcessos",
                "summary": "Schema of «Access reviews» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "revisoes_acessos"
            }
        },
        "/r/revisoes_acessos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Access reviews"
                ],
                "operationId": "obterRevisoesAcessos",
                "summary": "Get Access review",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_revisoes_acessos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "revisoes_acessos"
            }
        },
        "/r/revisoes_acessos/{id}/acao/concluir": {
            "post": {
                "tags": [
                    "Recurso: Access reviews"
                ],
                "operationId": "acaoConcluirRevisoesAcessos",
                "summary": "Action: Complete",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "notas": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Conclusions",
                                        "maxLength": 5000
                                    },
                                    "alteracoes": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Changes made",
                                        "maxLength": 5000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "revisoes_acessos"
            }
        },
        "/r/revisoes_acessos/{id}/acao/ver": {
            "post": {
                "tags": [
                    "Recurso: Access reviews"
                ],
                "operationId": "acaoVerRevisoesAcessos",
                "summary": "Action: View snapshot",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "revisoes_acessos"
            }
        },
        "/r/segmentos": {
            "get": {
                "tags": [
                    "Recurso: Segments"
                ],
                "operationId": "listarSegmentos",
                "summary": "List Segments",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[usa_dados_clinicos]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Uses clinical data». List: a,b; range: f[usa_dados_clinicos][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_segmentos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "segmentos"
            },
            "post": {
                "tags": [
                    "Recurso: Segments"
                ],
                "operationId": "criarSegmentos",
                "summary": "Create Segment",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_segmentos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_segmentos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_segmentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "segmentos"
            }
        },
        "/r/segmentos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Segments"
                ],
                "operationId": "esquemaSegmentos",
                "summary": "Schema of «Segments» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "segmentos"
            }
        },
        "/r/segmentos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Segments"
                ],
                "operationId": "obterSegmentos",
                "summary": "Get Segment",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_segmentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "segmentos"
            },
            "put": {
                "tags": [
                    "Recurso: Segments"
                ],
                "operationId": "alterarSegmentos",
                "summary": "Update Segment",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_segmentos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_segmentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "segmentos"
            },
            "delete": {
                "tags": [
                    "Recurso: Segments"
                ],
                "operationId": "apagarSegmentos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "segmentos"
            }
        },
        "/r/segmentos/{id}/acao/contar": {
            "post": {
                "tags": [
                    "Recurso: Segments"
                ],
                "operationId": "acaoContarSegmentos",
                "summary": "Action: Count now",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "marketing:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "segmentos"
            }
        },
        "/r/sequencias": {
            "get": {
                "tags": [
                    "Recurso: Sequences"
                ],
                "operationId": "listarSequencias",
                "summary": "List Sequences",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[gatilho]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Starts when». List: a,b; range: f[gatilho][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_sequencias"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "sequencias"
            },
            "post": {
                "tags": [
                    "Recurso: Sequences"
                ],
                "operationId": "criarSequencias",
                "summary": "Create Sequence",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_sequencias_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_sequencias_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_sequencias"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "sequencias"
            }
        },
        "/r/sequencias/esquema": {
            "get": {
                "tags": [
                    "Recurso: Sequences"
                ],
                "operationId": "esquemaSequencias",
                "summary": "Schema of «Sequences» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "sequencias"
            }
        },
        "/r/sequencias/{id}": {
            "get": {
                "tags": [
                    "Recurso: Sequences"
                ],
                "operationId": "obterSequencias",
                "summary": "Get Sequence",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_sequencias"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "sequencias"
            },
            "put": {
                "tags": [
                    "Recurso: Sequences"
                ],
                "operationId": "alterarSequencias",
                "summary": "Update Sequence",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_sequencias_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_sequencias"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "sequencias"
            },
            "delete": {
                "tags": [
                    "Recurso: Sequences"
                ],
                "operationId": "apagarSequencias",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.leads:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "sequencias"
            }
        },
        "/r/stock_movimentos": {
            "get": {
                "tags": [
                    "Recurso: Stock movements"
                ],
                "operationId": "listarStockMovimentos",
                "summary": "List Stock movements",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[artigo_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Item». List: a,b; range: f[artigo_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[lote]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Batch». List: a,b; range: f[lote][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[validade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Expiry date». List: a,b; range: f[validade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[cirurgia_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Surgery». List: a,b; range: f[cirurgia_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[encomenda_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Order». List: a,b; range: f[encomenda_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[criado_em]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[criado_em][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_stock_movimentos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "stock_movimentos"
            },
            "post": {
                "tags": [
                    "Recurso: Stock movements"
                ],
                "operationId": "criarStockMovimentos",
                "summary": "Create Stock movement",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_stock_movimentos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_stock_movimentos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_stock_movimentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "stock_movimentos"
            }
        },
        "/r/stock_movimentos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Stock movements"
                ],
                "operationId": "esquemaStockMovimentos",
                "summary": "Schema of «Stock movements» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "stock_movimentos"
            }
        },
        "/r/stock_movimentos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Stock movements"
                ],
                "operationId": "obterStockMovimentos",
                "summary": "Get Stock movement",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_stock_movimentos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "stock_movimentos"
            }
        },
        "/r/subcontratantes": {
            "get": {
                "tags": [
                    "Recurso: Processors"
                ],
                "operationId": "listarSubcontratantes",
                "summary": "List Processors",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[pais]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Country». List: a,b; range: f[pais][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[contrato_ate]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Contract until». List: a,b; range: f[contrato_ate][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[dpa_assinado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Processing agreement signed». List: a,b; range: f[dpa_assinado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[sistema_ia]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Artificial intelligence system». List: a,b; range: f[sistema_ia][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[transferencia_internacional]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Transfer outside the EEA». List: a,b; range: f[transferencia_internacional][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_subcontratantes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "subcontratantes"
            },
            "post": {
                "tags": [
                    "Recurso: Processors"
                ],
                "operationId": "criarSubcontratantes",
                "summary": "Create Processor",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_subcontratantes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_subcontratantes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_subcontratantes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "subcontratantes"
            }
        },
        "/r/subcontratantes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Processors"
                ],
                "operationId": "esquemaSubcontratantes",
                "summary": "Schema of «Processors» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "subcontratantes"
            }
        },
        "/r/subcontratantes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Processors"
                ],
                "operationId": "obterSubcontratantes",
                "summary": "Get Processor",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_subcontratantes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "subcontratantes"
            },
            "put": {
                "tags": [
                    "Recurso: Processors"
                ],
                "operationId": "alterarSubcontratantes",
                "summary": "Update Processor",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_subcontratantes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_subcontratantes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "subcontratantes"
            },
            "delete": {
                "tags": [
                    "Recurso: Processors"
                ],
                "operationId": "apagarSubcontratantes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "subcontratantes"
            }
        },
        "/r/supressoes": {
            "get": {
                "tags": [
                    "Recurso: Contact opt-outs"
                ],
                "operationId": "listarSupressoes",
                "summary": "List Contact opt-outs",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[canal]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Channel». List: a,b; range: f[canal][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Source». List: a,b; range: f[origem][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_supressoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "supressoes"
            },
            "post": {
                "tags": [
                    "Recurso: Contact opt-outs"
                ],
                "operationId": "criarSupressoes",
                "summary": "Create Opt-out",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_supressoes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_supressoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_supressoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "supressoes"
            }
        },
        "/r/supressoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Contact opt-outs"
                ],
                "operationId": "esquemaSupressoes",
                "summary": "Schema of «Contact opt-outs» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "supressoes"
            }
        },
        "/r/supressoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Contact opt-outs"
                ],
                "operationId": "obterSupressoes",
                "summary": "Get Opt-out",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_supressoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "supressoes"
            },
            "delete": {
                "tags": [
                    "Recurso: Contact opt-outs"
                ],
                "operationId": "apagarSupressoes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "conformidade:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "supressoes"
            }
        },
        "/r/tabelas_precos": {
            "get": {
                "tags": [
                    "Recurso: Price lists"
                ],
                "operationId": "listarTabelasPrecos",
                "summary": "List Price lists",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[procedimento_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Procedure». List: a,b; range: f[procedimento_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[local_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Location». List: a,b; range: f[local_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_tabelas_precos"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tabelas_precos"
            },
            "post": {
                "tags": [
                    "Recurso: Price lists"
                ],
                "operationId": "criarTabelasPrecos",
                "summary": "Create Price list",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tabelas_precos_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tabelas_precos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tabelas_precos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tabelas_precos"
            }
        },
        "/r/tabelas_precos/esquema": {
            "get": {
                "tags": [
                    "Recurso: Price lists"
                ],
                "operationId": "esquemaTabelasPrecos",
                "summary": "Schema of «Price lists» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tabelas_precos"
            }
        },
        "/r/tabelas_precos/{id}": {
            "get": {
                "tags": [
                    "Recurso: Price lists"
                ],
                "operationId": "obterTabelasPrecos",
                "summary": "Get Price list",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tabelas_precos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tabelas_precos"
            },
            "put": {
                "tags": [
                    "Recurso: Price lists"
                ],
                "operationId": "alterarTabelasPrecos",
                "summary": "Update Price list",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tabelas_precos_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tabelas_precos"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tabelas_precos"
            },
            "delete": {
                "tags": [
                    "Recurso: Price lists"
                ],
                "operationId": "apagarTabelasPrecos",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tabelas_precos"
            }
        },
        "/r/tabelas_precos/{id}/acao/simular": {
            "post": {
                "tags": [
                    "Recurso: Price lists"
                ],
                "operationId": "acaoSimularTabelasPrecos",
                "summary": "Action: Simulate",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "enxertos": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "title": "Grafts",
                                        "maximum": 15000,
                                        "minimum": 1,
                                        "x-unidade": "enxertos"
                                    },
                                    "sessoes": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "title": "Sessions",
                                        "maximum": 6,
                                        "minimum": 1,
                                        "default": 1
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "tabelas_precos"
            }
        },
        "/r/tarefas": {
            "get": {
                "tags": [
                    "Recurso: Tasks"
                ],
                "operationId": "listarTarefas",
                "summary": "List Tasks",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[prioridade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Priority». List: a,b; range: f[prioridade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[prazo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Due date». List: a,b; range: f[prazo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[responsavel_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Owner». List: a,b; range: f[responsavel_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[departamento]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Department». List: a,b; range: f[departamento][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Source». List: a,b; range: f[origem][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_tarefas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tarefas"
            },
            "post": {
                "tags": [
                    "Recurso: Tasks"
                ],
                "operationId": "criarTarefas",
                "summary": "Create Task",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tarefas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tarefas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tarefas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tarefas"
            }
        },
        "/r/tarefas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Tasks"
                ],
                "operationId": "esquemaTarefas",
                "summary": "Schema of «Tasks» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tarefas"
            }
        },
        "/r/tarefas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Tasks"
                ],
                "operationId": "obterTarefas",
                "summary": "Get Task",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tarefas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tarefas"
            },
            "put": {
                "tags": [
                    "Recurso: Tasks"
                ],
                "operationId": "alterarTarefas",
                "summary": "Update Task",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tarefas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tarefas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tarefas"
            },
            "delete": {
                "tags": [
                    "Recurso: Tasks"
                ],
                "operationId": "apagarTarefas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tarefas"
            }
        },
        "/r/tarefas/{id}/acao/concluir": {
            "post": {
                "tags": [
                    "Recurso: Tasks"
                ],
                "operationId": "acaoConcluirTarefas",
                "summary": "Action: Complete",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tarefas"
            }
        },
        "/r/tarefas/{id}/acao/reabrir": {
            "post": {
                "tags": [
                    "Recurso: Tasks"
                ],
                "operationId": "acaoReabrirTarefas",
                "summary": "Action: Reopen",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tarefas"
            }
        },
        "/r/teleconsultas": {
            "get": {
                "tags": [
                    "Recurso: Teleconsultations"
                ],
                "operationId": "listarTeleconsultas",
                "summary": "List Teleconsultations",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "teleconsulta:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[medico_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Doctor». List: a,b; range: f[medico_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_teleconsultas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "teleconsultas"
            }
        },
        "/r/teleconsultas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Teleconsultations"
                ],
                "operationId": "esquemaTeleconsultas",
                "summary": "Schema of «Teleconsultations» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "teleconsulta:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "teleconsultas"
            }
        },
        "/r/teleconsultas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Teleconsultations"
                ],
                "operationId": "obterTeleconsultas",
                "summary": "Get Teleconsultation",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "teleconsulta:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_teleconsultas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "teleconsultas"
            }
        },
        "/r/telefonia_extensoes": {
            "get": {
                "tags": [
                    "Recurso: Extensions"
                ],
                "operationId": "listarTelefoniaExtensoes",
                "summary": "List Extensions",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Type». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_telefonia_extensoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "telefonia_extensoes"
            },
            "post": {
                "tags": [
                    "Recurso: Extensions"
                ],
                "operationId": "criarTelefoniaExtensoes",
                "summary": "Create Extension",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_telefonia_extensoes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_telefonia_extensoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_telefonia_extensoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "telefonia_extensoes"
            }
        },
        "/r/telefonia_extensoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Extensions"
                ],
                "operationId": "esquemaTelefoniaExtensoes",
                "summary": "Schema of «Extensions» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "telefonia_extensoes"
            }
        },
        "/r/telefonia_extensoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Extensions"
                ],
                "operationId": "obterTelefoniaExtensoes",
                "summary": "Get Extension",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_telefonia_extensoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "telefonia_extensoes"
            },
            "put": {
                "tags": [
                    "Recurso: Extensions"
                ],
                "operationId": "alterarTelefoniaExtensoes",
                "summary": "Update Extension",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_telefonia_extensoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_telefonia_extensoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "telefonia_extensoes"
            },
            "delete": {
                "tags": [
                    "Recurso: Extensions"
                ],
                "operationId": "apagarTelefoniaExtensoes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "telefonia_extensoes"
            }
        },
        "/r/telefonia_numeros": {
            "get": {
                "tags": [
                    "Recurso: Clinic numbers"
                ],
                "operationId": "listarTelefoniaNumeros",
                "summary": "List Clinic numbers",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[origem]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Lead source». List: a,b; range: f[origem][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_telefonia_numeros"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "telefonia_numeros"
            },
            "post": {
                "tags": [
                    "Recurso: Clinic numbers"
                ],
                "operationId": "criarTelefoniaNumeros",
                "summary": "Create Number",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_telefonia_numeros_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_telefonia_numeros_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_telefonia_numeros"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "telefonia_numeros"
            }
        },
        "/r/telefonia_numeros/esquema": {
            "get": {
                "tags": [
                    "Recurso: Clinic numbers"
                ],
                "operationId": "esquemaTelefoniaNumeros",
                "summary": "Schema of «Clinic numbers» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "telefonia_numeros"
            }
        },
        "/r/telefonia_numeros/{id}": {
            "get": {
                "tags": [
                    "Recurso: Clinic numbers"
                ],
                "operationId": "obterTelefoniaNumeros",
                "summary": "Get Number",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_telefonia_numeros"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "telefonia_numeros"
            },
            "put": {
                "tags": [
                    "Recurso: Clinic numbers"
                ],
                "operationId": "alterarTelefoniaNumeros",
                "summary": "Update Number",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_telefonia_numeros_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_telefonia_numeros"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "telefonia_numeros"
            },
            "delete": {
                "tags": [
                    "Recurso: Clinic numbers"
                ],
                "operationId": "apagarTelefoniaNumeros",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "telefonia_numeros"
            }
        },
        "/r/terminais_pagamento": {
            "get": {
                "tags": [
                    "Recurso: Payment terminals"
                ],
                "operationId": "listarTerminaisPagamento",
                "summary": "List Payment terminals",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[fornecedor]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Provider». List: a,b; range: f[fornecedor][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[local_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Location». List: a,b; range: f[local_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_terminais_pagamento"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "terminais_pagamento"
            },
            "post": {
                "tags": [
                    "Recurso: Payment terminals"
                ],
                "operationId": "criarTerminaisPagamento",
                "summary": "Create Payment terminal",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_terminais_pagamento_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_terminais_pagamento_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_terminais_pagamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "terminais_pagamento"
            }
        },
        "/r/terminais_pagamento/esquema": {
            "get": {
                "tags": [
                    "Recurso: Payment terminals"
                ],
                "operationId": "esquemaTerminaisPagamento",
                "summary": "Schema of «Payment terminals» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "terminais_pagamento"
            }
        },
        "/r/terminais_pagamento/{id}": {
            "get": {
                "tags": [
                    "Recurso: Payment terminals"
                ],
                "operationId": "obterTerminaisPagamento",
                "summary": "Get Payment terminal",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_terminais_pagamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "terminais_pagamento"
            },
            "put": {
                "tags": [
                    "Recurso: Payment terminals"
                ],
                "operationId": "alterarTerminaisPagamento",
                "summary": "Update Payment terminal",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_terminais_pagamento_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_terminais_pagamento"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "terminais_pagamento"
            },
            "delete": {
                "tags": [
                    "Recurso: Payment terminals"
                ],
                "operationId": "apagarTerminaisPagamento",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "terminais_pagamento"
            }
        },
        "/r/terminais_pagamento/{id}/acao/emparelhar": {
            "post": {
                "tags": [
                    "Recurso: Payment terminals"
                ],
                "operationId": "acaoEmparelharTerminaisPagamento",
                "summary": "Action: Pair",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "codigo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Device code",
                                        "description": "SumUp: Connections › API › Connect. Stripe: registration code shown on the reader.",
                                        "maxLength": 60
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "terminais_pagamento"
            }
        },
        "/r/terminais_pagamento/{id}/acao/verificar": {
            "post": {
                "tags": [
                    "Recurso: Payment terminals"
                ],
                "operationId": "acaoVerificarTerminaisPagamento",
                "summary": "Action: Check status",
                "description": "Required level: ver.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "ver",
                "x-anagen-recurso": "terminais_pagamento"
            }
        },
        "/r/tratamentos_complementares": {
            "get": {
                "tags": [
                    "Recurso: Complementary treatments"
                ],
                "operationId": "listarTratamentosComplementares",
                "summary": "List Complementary treatments",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[tipo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Treatment». List: a,b; range: f[tipo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[inicio]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Start». List: a,b; range: f[inicio][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[adesao]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Adherence». List: a,b; range: f[adesao][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_tratamentos_complementares"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tratamentos_complementares"
            },
            "post": {
                "tags": [
                    "Recurso: Complementary treatments"
                ],
                "operationId": "criarTratamentosComplementares",
                "summary": "Create Complementary treatment",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tratamentos_complementares_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tratamentos_complementares_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tratamentos_complementares"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tratamentos_complementares"
            }
        },
        "/r/tratamentos_complementares/esquema": {
            "get": {
                "tags": [
                    "Recurso: Complementary treatments"
                ],
                "operationId": "esquemaTratamentosComplementares",
                "summary": "Schema of «Complementary treatments» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tratamentos_complementares"
            }
        },
        "/r/tratamentos_complementares/{id}": {
            "get": {
                "tags": [
                    "Recurso: Complementary treatments"
                ],
                "operationId": "obterTratamentosComplementares",
                "summary": "Get Complementary treatment",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tratamentos_complementares"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tratamentos_complementares"
            },
            "put": {
                "tags": [
                    "Recurso: Complementary treatments"
                ],
                "operationId": "alterarTratamentosComplementares",
                "summary": "Update Complementary treatment",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tratamentos_complementares_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tratamentos_complementares"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tratamentos_complementares"
            },
            "delete": {
                "tags": [
                    "Recurso: Complementary treatments"
                ],
                "operationId": "apagarTratamentosComplementares",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tratamentos_complementares"
            }
        },
        "/r/tratamentos_complementares/{id}/acao/registar_sessao": {
            "post": {
                "tags": [
                    "Recurso: Complementary treatments"
                ],
                "operationId": "acaoRegistarSessaoTratamentosComplementares",
                "summary": "Action: Record session",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "acompanhamento:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "proxima_sessao_em": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "title": "Next session"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tratamentos_complementares"
            }
        },
        "/r/tricoscopias": {
            "get": {
                "tags": [
                    "Recurso: Trichoscopy fields"
                ],
                "operationId": "listarTricoscopias",
                "summary": "List Trichoscopy fields",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission. Every read is audited.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Patient». List: a,b; range: f[paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[captura_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Capture». List: a,b; range: f[captura_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[data]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Date». List: a,b; range: f[data][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[subzona]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Subzone». List: a,b; range: f[subzona][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[aparelho]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Device». List: a,b; range: f[aparelho][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_tricoscopias"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tricoscopias"
            },
            "post": {
                "tags": [
                    "Recurso: Trichoscopy fields"
                ],
                "operationId": "criarTricoscopias",
                "summary": "Create Trichoscopy field",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tricoscopias_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tricoscopias_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tricoscopias"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tricoscopias"
            }
        },
        "/r/tricoscopias/esquema": {
            "get": {
                "tags": [
                    "Recurso: Trichoscopy fields"
                ],
                "operationId": "esquemaTricoscopias",
                "summary": "Schema of «Trichoscopy fields» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tricoscopias"
            }
        },
        "/r/tricoscopias/{id}": {
            "get": {
                "tags": [
                    "Recurso: Trichoscopy fields"
                ],
                "operationId": "obterTricoscopias",
                "summary": "Get Trichoscopy field",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tricoscopias"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "tricoscopias"
            },
            "put": {
                "tags": [
                    "Recurso: Trichoscopy fields"
                ],
                "operationId": "alterarTricoscopias",
                "summary": "Update Trichoscopy field",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_tricoscopias_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_tricoscopias"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tricoscopias"
            },
            "delete": {
                "tags": [
                    "Recurso: Trichoscopy fields"
                ],
                "operationId": "apagarTricoscopias",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "tricoscopias"
            }
        },
        "/r/utilizadores": {
            "get": {
                "tags": [
                    "Recurso: Users"
                ],
                "operationId": "listarUtilizadores",
                "summary": "List Users",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[perfil_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Profile». List: a,b; range: f[perfil_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[nivel]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Level». List: a,b; range: f[nivel][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[departamento]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Department». List: a,b; range: f[departamento][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[direcao_clinica]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Clinical director». List: a,b; range: f[direcao_clinica][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[totp_ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Second factor». List: a,b; range: f[totp_ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_utilizadores"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "utilizadores"
            },
            "post": {
                "tags": [
                    "Recurso: Users"
                ],
                "operationId": "criarUtilizadores",
                "summary": "Create User",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_utilizadores_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_utilizadores_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_utilizadores"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "utilizadores"
            }
        },
        "/r/utilizadores/esquema": {
            "get": {
                "tags": [
                    "Recurso: Users"
                ],
                "operationId": "esquemaUtilizadores",
                "summary": "Schema of «Users» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "utilizadores"
            }
        },
        "/r/utilizadores/{id}": {
            "get": {
                "tags": [
                    "Recurso: Users"
                ],
                "operationId": "obterUtilizadores",
                "summary": "Get User",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_utilizadores"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "utilizadores"
            },
            "put": {
                "tags": [
                    "Recurso: Users"
                ],
                "operationId": "alterarUtilizadores",
                "summary": "Update User",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_utilizadores_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_utilizadores"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "utilizadores"
            },
            "delete": {
                "tags": [
                    "Recurso: Users"
                ],
                "operationId": "apagarUtilizadores",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "utilizadores"
            }
        },
        "/r/utilizadores/{id}/acao/desbloquear": {
            "post": {
                "tags": [
                    "Recurso: Users"
                ],
                "operationId": "acaoDesbloquearUtilizadores",
                "summary": "Action: Unlock",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "utilizadores"
            }
        },
        "/r/utilizadores/{id}/acao/enviar_convite": {
            "post": {
                "tags": [
                    "Recurso: Users"
                ],
                "operationId": "acaoEnviarConviteUtilizadores",
                "summary": "Action: Send invitation",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "utilizadores"
            }
        },
        "/r/utilizadores/{id}/acao/repor_2fa": {
            "post": {
                "tags": [
                    "Recurso: Users"
                ],
                "operationId": "acaoRepor2faUtilizadores",
                "summary": "Action: Reset second factor",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "utilizadores"
            }
        },
        "/r/utilizadores/{id}/acao/revogar_sessoes": {
            "post": {
                "tags": [
                    "Recurso: Users"
                ],
                "operationId": "acaoRevogarSessoesUtilizadores",
                "summary": "Action: End sessions",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.utilizadores:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "utilizadores"
            }
        },
        "/r/vales": {
            "get": {
                "tags": [
                    "Recurso: Gift vouchers"
                ],
                "operationId": "listarVales",
                "summary": "List Gift vouchers",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[validade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Valid until». List: a,b; range: f[validade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[finalidade]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Voucher type». List: a,b; range: f[finalidade][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[comprador_paciente_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Buyer patient». List: a,b; range: f[comprador_paciente_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[local_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Location». List: a,b; range: f[local_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_vales"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "vales"
            }
        },
        "/r/vales/esquema": {
            "get": {
                "tags": [
                    "Recurso: Gift vouchers"
                ],
                "operationId": "esquemaVales",
                "summary": "Schema of «Gift vouchers» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "vales"
            }
        },
        "/r/vales/{id}": {
            "get": {
                "tags": [
                    "Recurso: Gift vouchers"
                ],
                "operationId": "obterVales",
                "summary": "Get Gift voucher",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_vales"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "vales"
            },
            "put": {
                "tags": [
                    "Recurso: Gift vouchers"
                ],
                "operationId": "alterarVales",
                "summary": "Update Gift voucher",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_vales_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_vales"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "vales"
            }
        },
        "/r/vales/{id}/acao/anular": {
            "post": {
                "tags": [
                    "Recurso: Gift vouchers"
                ],
                "operationId": "acaoAnularVales",
                "summary": "Action: Cancel voucher",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "financeiro.pagamentos:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "title": "Reason",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "vales"
            }
        },
        "/r/voz_gravacoes": {
            "get": {
                "tags": [
                    "Recurso: Recorded messages"
                ],
                "operationId": "listarVozGravacoes",
                "summary": "List Recorded messages",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[lingua]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Language». List: a,b; range: f[lingua][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_voz_gravacoes"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "voz_gravacoes"
            },
            "post": {
                "tags": [
                    "Recurso: Recorded messages"
                ],
                "operationId": "criarVozGravacoes",
                "summary": "Create Recorded message",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_voz_gravacoes_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_voz_gravacoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_voz_gravacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "voz_gravacoes"
            }
        },
        "/r/voz_gravacoes/esquema": {
            "get": {
                "tags": [
                    "Recurso: Recorded messages"
                ],
                "operationId": "esquemaVozGravacoes",
                "summary": "Schema of «Recorded messages» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "voz_gravacoes"
            }
        },
        "/r/voz_gravacoes/{id}": {
            "get": {
                "tags": [
                    "Recurso: Recorded messages"
                ],
                "operationId": "obterVozGravacoes",
                "summary": "Get Recorded message",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_voz_gravacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "voz_gravacoes"
            },
            "put": {
                "tags": [
                    "Recurso: Recorded messages"
                ],
                "operationId": "alterarVozGravacoes",
                "summary": "Update Recorded message",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_voz_gravacoes_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_voz_gravacoes"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "voz_gravacoes"
            },
            "delete": {
                "tags": [
                    "Recurso: Recorded messages"
                ],
                "operationId": "apagarVozGravacoes",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "voz_gravacoes"
            }
        },
        "/r/voz_menus": {
            "get": {
                "tags": [
                    "Recurso: Voice menus"
                ],
                "operationId": "listarVozMenus",
                "summary": "List Voice menus",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_voz_menus"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "voz_menus"
            },
            "post": {
                "tags": [
                    "Recurso: Voice menus"
                ],
                "operationId": "criarVozMenus",
                "summary": "Create Voice menu",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_voz_menus_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_voz_menus_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_voz_menus"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "voz_menus"
            }
        },
        "/r/voz_menus/esquema": {
            "get": {
                "tags": [
                    "Recurso: Voice menus"
                ],
                "operationId": "esquemaVozMenus",
                "summary": "Schema of «Voice menus» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "voz_menus"
            }
        },
        "/r/voz_menus/{id}": {
            "get": {
                "tags": [
                    "Recurso: Voice menus"
                ],
                "operationId": "obterVozMenus",
                "summary": "Get Voice menu",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_voz_menus"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "voz_menus"
            },
            "put": {
                "tags": [
                    "Recurso: Voice menus"
                ],
                "operationId": "alterarVozMenus",
                "summary": "Update Voice menu",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_voz_menus_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_voz_menus"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "voz_menus"
            },
            "delete": {
                "tags": [
                    "Recurso: Voice menus"
                ],
                "operationId": "apagarVozMenus",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "voz_menus"
            }
        },
        "/r/voz_menus/{id}/acao/editor": {
            "post": {
                "tags": [
                    "Recurso: Voice menus"
                ],
                "operationId": "acaoEditorVozMenus",
                "summary": "Action: Open the editor",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "crm.telefonia:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "voz_menus"
            }
        },
        "/r/webhooks": {
            "get": {
                "tags": [
                    "Recurso: Webhooks"
                ],
                "operationId": "listarWebhooks",
                "summary": "List Webhooks",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[ativo]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativo][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_webhooks"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "webhooks"
            },
            "post": {
                "tags": [
                    "Recurso: Webhooks"
                ],
                "operationId": "criarWebhooks",
                "summary": "Create Webhook destination",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_webhooks_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_webhooks_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_webhooks"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "webhooks"
            }
        },
        "/r/webhooks/esquema": {
            "get": {
                "tags": [
                    "Recurso: Webhooks"
                ],
                "operationId": "esquemaWebhooks",
                "summary": "Schema of «Webhooks» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "webhooks"
            }
        },
        "/r/webhooks/{id}": {
            "get": {
                "tags": [
                    "Recurso: Webhooks"
                ],
                "operationId": "obterWebhooks",
                "summary": "Get Webhook destination",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_webhooks"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "webhooks"
            },
            "put": {
                "tags": [
                    "Recurso: Webhooks"
                ],
                "operationId": "alterarWebhooks",
                "summary": "Update Webhook destination",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_webhooks_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_webhooks"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "webhooks"
            },
            "delete": {
                "tags": [
                    "Recurso: Webhooks"
                ],
                "operationId": "apagarWebhooks",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "webhooks"
            }
        },
        "/r/webhooks/{id}/acao/rodar_segredo": {
            "post": {
                "tags": [
                    "Recurso: Webhooks"
                ],
                "operationId": "acaoRodarSegredoWebhooks",
                "summary": "Action: Rotate secret",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "webhooks"
            }
        },
        "/r/webhooks/{id}/acao/testar": {
            "post": {
                "tags": [
                    "Recurso: Webhooks"
                ],
                "operationId": "acaoTestarWebhooks",
                "summary": "Action: Send test",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "webhooks"
            }
        },
        "/r/webhooks_entregas": {
            "get": {
                "tags": [
                    "Recurso: Webhook deliveries"
                ],
                "operationId": "listarWebhooksEntregas",
                "summary": "List Webhook deliveries",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[webhook_id]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Destination». List: a,b; range: f[webhook_id][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[evento]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Event». List: a,b; range: f[evento][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[estado]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Status». List: a,b; range: f[estado][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_webhooks_entregas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "webhooks_entregas"
            }
        },
        "/r/webhooks_entregas/esquema": {
            "get": {
                "tags": [
                    "Recurso: Webhook deliveries"
                ],
                "operationId": "esquemaWebhooksEntregas",
                "summary": "Schema of «Webhook deliveries» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "webhooks_entregas"
            }
        },
        "/r/webhooks_entregas/{id}": {
            "get": {
                "tags": [
                    "Recurso: Webhook deliveries"
                ],
                "operationId": "obterWebhooksEntregas",
                "summary": "Get Delivery",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_webhooks_entregas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "webhooks_entregas"
            }
        },
        "/r/webhooks_entregas/{id}/acao/reenviar": {
            "post": {
                "tags": [
                    "Recurso: Webhook deliveries"
                ],
                "operationId": "acaoReenviarWebhooksEntregas",
                "summary": "Action: Resend",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "webhooks_entregas"
            }
        },
        "/r/whatsapp_linhas": {
            "get": {
                "tags": [
                    "Recurso: WhatsApp lines"
                ],
                "operationId": "listarWhatsappLinhas",
                "summary": "List WhatsApp lines",
                "description": "Search, filters, sorting and pagination; honours scope (own/team/all) and strips fields without permission.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Q"
                    },
                    {
                        "$ref": "#/components/parameters/Ordem"
                    },
                    {
                        "$ref": "#/components/parameters/Pagina"
                    },
                    {
                        "$ref": "#/components/parameters/PorPagina"
                    },
                    {
                        "name": "f[departamento]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Department». List: a,b; range: f[departamento][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "f[ativa]",
                        "in": "query",
                        "required": false,
                        "style": "form",
                        "description": "Filter by «Active». List: a,b; range: f[ativa][from|to] as [de]/[ate].",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of results",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Recurso_whatsapp_linhas"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "whatsapp_linhas"
            },
            "post": {
                "tags": [
                    "Recurso: WhatsApp lines"
                ],
                "operationId": "criarWhatsappLinhas",
                "summary": "Create WhatsApp line",
                "description": "Server-side validation generated from the field definitions. Accepts Idempotency-Key.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_whatsapp_linhas_Entrada"
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_whatsapp_linhas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_whatsapp_linhas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "whatsapp_linhas"
            }
        },
        "/r/whatsapp_linhas/esquema": {
            "get": {
                "tags": [
                    "Recurso: WhatsApp lines"
                ],
                "operationId": "esquemaWhatsappLinhas",
                "summary": "Schema of «WhatsApp lines» (fields, sections, actions)",
                "description": "Returns only the fields and actions the caller may access, labelled in the requested language.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/EsquemaRecurso"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "whatsapp_linhas"
            }
        },
        "/r/whatsapp_linhas/{id}": {
            "get": {
                "tags": [
                    "Recurso: WhatsApp lines"
                ],
                "operationId": "obterWhatsappLinhas",
                "summary": "Get WhatsApp line",
                "description": "Record within scope (out of scope answers 404). Encrypted fields are decrypted only for permitted callers.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_whatsapp_linhas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "resumo",
                "x-anagen-recurso": "whatsapp_linhas"
            },
            "put": {
                "tags": [
                    "Recurso: WhatsApp lines"
                ],
                "operationId": "alterarWhatsappLinhas",
                "summary": "Update WhatsApp line",
                "description": "Partial update: only the fields sent.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Recurso_whatsapp_linhas_Entrada"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Recurso_whatsapp_linhas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "whatsapp_linhas"
            },
            "delete": {
                "tags": [
                    "Recurso: WhatsApp lines"
                ],
                "operationId": "apagarWhatsappLinhas",
                "summary": "Delete (soft delete)",
                "description": "The record is hidden but kept for legal and audit purposes.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "whatsapp_linhas"
            }
        },
        "/r/whatsapp_linhas/{id}/acao/testar": {
            "post": {
                "tags": [
                    "Recurso: WhatsApp lines"
                ],
                "operationId": "acaoTestarWhatsappLinhas",
                "summary": "Action: Test the line",
                "description": "Required level: editar.",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "admin.definicoes:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {}
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/XRateLimitRemaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ResultadoAcao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "x-anagen-recurso": "whatsapp_linhas"
            }
        },
        "/reunioes/{id}/acoes/{acao}/aprovar": {
            "post": {
                "tags": [
                    "Reuniões"
                ],
                "operationId": "aprovarAcaoReuniao",
                "summary": "Approve an action (creates the task)",
                "description": "Creates the task with the chosen owner and deadline. The title is the one sent in «titulo» or a neutral title with the meeting name — the (encrypted) action text is not copied to the task. Also requires equipa.tarefas edit.",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Meeting identifier"
                    },
                    {
                        "name": "acao",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Action identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "responsavel_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "prazo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date"
                                    },
                                    "titulo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 200
                                    },
                                    "prioridade": {
                                        "type": "string",
                                        "enum": [
                                            "baixa",
                                            "normal",
                                            "alta",
                                            "urgente"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "responsavel_id": 9,
                                "prazo": "2026-11-03",
                                "titulo": "Rever o stock de agulhas"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "tarefa_id": {
                                                    "type": "integer"
                                                },
                                                "sessao": {
                                                    "$ref": "#/components/schemas/SessaoReuniao"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/reunioes/{id}/acoes/{acao}/rejeitar": {
            "post": {
                "tags": [
                    "Reuniões"
                ],
                "operationId": "rejeitarAcaoReuniao",
                "summary": "Reject an action",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Meeting identifier"
                    },
                    {
                        "name": "acao",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Action identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SessaoReuniao"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    }
                }
            }
        },
        "/reunioes/{id}/audio": {
            "post": {
                "tags": [
                    "Reuniões"
                ],
                "operationId": "enviarAudioReuniao",
                "summary": "Upload an audio part",
                "description": "Numbered part (16 kHz mono WAV recommended; MP3, M4A, OGG and WEBM accepted; up to 25 MB and 15 min). Requires a recorded/transcribed meeting with notice, at least one attendee and ALL consenting. The part is encrypted at rest and transcribed immediately (local service first; external service only when allowed for team data). Audio is deleted after the configured period. Repeated parts are ignored (repetida=true).",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Meeting identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "parte": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "lingua": {
                                        "type": "string",
                                        "example": "pt-PT"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "parte": {
                                                    "type": "integer"
                                                },
                                                "estado": {
                                                    "type": "string",
                                                    "enum": [
                                                        "recebido",
                                                        "transcrito",
                                                        "erro"
                                                    ]
                                                },
                                                "repetida": {
                                                    "type": "boolean"
                                                },
                                                "sessao": {
                                                    "$ref": "#/components/schemas/SessaoReuniao"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/reunioes/{id}/consentir": {
            "post": {
                "tags": [
                    "Reuniões"
                ],
                "operationId": "consentirGravacaoReuniao",
                "summary": "My recording decision",
                "description": "The participant gives, refuses or withdraws consent. A refusal or withdrawal blocks new audio parts. Recorded with date, origin and IP.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Meeting identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "consentimento"
                                ],
                                "properties": {
                                    "consentimento": {
                                        "type": "string",
                                        "enum": [
                                            "dado",
                                            "recusado",
                                            "retirado"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "consentimento": "dado"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SessaoReuniao"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/reunioes/{id}/presencas": {
            "post": {
                "tags": [
                    "Reuniões"
                ],
                "operationId": "registarPresencaReuniao",
                "summary": "Record another person’s attendance and decision",
                "description": "The organiser records the decision stated in the room by a colleague (utilizador_id) or an external guest (name, stored encrypted).",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Meeting identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "utilizador_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "nome": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 120
                                    },
                                    "consentimento": {
                                        "type": "string",
                                        "enum": [
                                            "dado",
                                            "recusado"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "utilizador_id": 9,
                                "consentimento": "dado"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SessaoReuniao"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/reunioes/{id}/resumo": {
            "put": {
                "tags": [
                    "Reuniões"
                ],
                "operationId": "gravarResumoReuniao",
                "summary": "Save (and validate) the summary",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Meeting identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "resumo"
                                ],
                                "properties": {
                                    "resumo": {
                                        "type": "string",
                                        "maxLength": 20000
                                    },
                                    "validar": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "resumo": "Revisão da agenda…",
                                "validar": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SessaoReuniao"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/reunioes/{id}/resumo/propor": {
            "post": {
                "tags": [
                    "Reuniões"
                ],
                "operationId": "proporResumoReuniao",
                "summary": "Ask the Assistant for summary and actions",
                "description": "From the transcript (and notes), returns a summary with decisions and creates the proposed actions (text, owner and deadline when stated). Stays a PROPOSAL until human validation. 503 when the Assistant is unavailable.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Meeting identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SessaoReuniao"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    },
                    "503": {
                        "description": "Assistant unavailable"
                    }
                }
            }
        },
        "/reunioes/{id}/sessao": {
            "get": {
                "tags": [
                    "Reuniões"
                ],
                "operationId": "obterSessaoReuniao",
                "summary": "Meeting state (recording, attendance, summary, actions)",
                "description": "Everything the meeting screen needs, WITHOUT the transcript text (read separately, audited). Access: participant, organiser or manager (equipa.chat edit with «all» scope).",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Meeting identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SessaoReuniao"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "reuniao": {
                                            "id": 12,
                                            "titulo": "Reunião de equipa semanal",
                                            "inicio": "2026-10-29T09:00:00+00:00",
                                            "estado": "em_curso",
                                            "gravada": true,
                                            "transcrita": true,
                                            "aviso_gravacao_em": "2026-10-28T17:00:00+00:00",
                                            "lingua": "pt-PT"
                                        },
                                        "participantes": [
                                            {
                                                "id": 4,
                                                "nome": "Ana Sousa"
                                            },
                                            {
                                                "id": 9,
                                                "nome": "Inês Costa"
                                            }
                                        ],
                                        "presencas": [
                                            {
                                                "id": 31,
                                                "utilizador_id": 4,
                                                "nome": "Ana Sousa",
                                                "externo": false,
                                                "consentimento": "dado",
                                                "decidido_em": "2026-10-29T09:01:00+00:00",
                                                "origem": "app"
                                            }
                                        ],
                                        "meu_consentimento": "dado",
                                        "gravacao": {
                                            "pode_gravar": true,
                                            "motivo": null,
                                            "parte_max_mb": 25,
                                            "parte_segundos": 60,
                                            "audio_horas": 48
                                        },
                                        "transcricao": {
                                            "tem": true,
                                            "partes": 3,
                                            "segundos": 182,
                                            "fornecedor": "ollama",
                                            "partes_lista": [
                                                {
                                                    "parte": 1,
                                                    "estado": "transcrito",
                                                    "segundos": 60,
                                                    "audio_apagado": false
                                                }
                                            ]
                                        },
                                        "resumo": {
                                            "texto": "Revisão da agenda da semana…",
                                            "validado": false,
                                            "fornecedor": "ollama"
                                        },
                                        "acoes": [
                                            {
                                                "id": 5,
                                                "ordem": 1,
                                                "texto": "Rever o stock de agulhas",
                                                "responsavel_id": 9,
                                                "responsavel_nome": "Inês Costa",
                                                "prazo": "2026-11-03",
                                                "estado": "proposta",
                                                "tarefa_id": null
                                            }
                                        ],
                                        "assistente": {
                                            "ouvir": true,
                                            "escrever": true
                                        },
                                        "permissoes": {
                                            "gerir": true,
                                            "consentir": true,
                                            "gravar": true,
                                            "resumir": true,
                                            "aprovar_acoes": true,
                                            "ler_transcricao": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/reunioes/{id}/transcricao": {
            "get": {
                "tags": [
                    "Reuniões"
                ],
                "operationId": "lerTranscricaoReuniao",
                "summary": "Read the transcript",
                "description": "Transcript text (decrypted). Each read is audited.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Meeting identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "texto": {
                                                    "type": "string"
                                                },
                                                "partes": {
                                                    "type": "integer"
                                                },
                                                "segundos": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "texto": "Bom dia a todos…",
                                        "partes": 3,
                                        "segundos": 182
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Reuniões"
                ],
                "operationId": "descartarTranscricaoReuniao",
                "summary": "Discard the transcript",
                "description": "Deletes the text and any audio still stored. The validated summary and decided actions are kept. Organiser or manager only.",
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Meeting identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SessaoReuniao"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/simulacoes-ia/{id}/usar": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "simulacaoIaUsar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Use a validated simulation as the plan simulation",
                "description": "Validated images only; checks the SHA-256. Resets «shown» and «acknowledgement» (new presentation).",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SimulacaoIaEstado"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/simulacoes-ia/{id}/validar": {
            "post": {
                "tags": [
                    "Planos cirúrgicos"
                ],
                "operationId": "simulacaoIaValidar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "aprovar",
                "summary": "Validate or reject a generated simulation",
                "description": "Only plan approvers (doctor). Rejecting requires the note (stored encrypted). With «usar_no_plano», the validated image immediately becomes the plan simulation.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "validar",
                                            "rejeitar"
                                        ]
                                    },
                                    "nota": {
                                        "type": "string"
                                    },
                                    "usar_no_plano": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "validar",
                                "usar_no_plano": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SimulacaoIaEstado"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/site/analytics": {
            "get": {
                "summary": "Website statistics and cookie decisions",
                "description": "Own measurement without cookies: visits, anonymous sessions (daily encrypted digest), pages, sources, campaigns, devices, languages, conversions and cookie decisions, with change versus the previous period. Up to 366 days; default is the last 30.",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "area",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "todas",
                                "site",
                                "apresentacao"
                            ]
                        },
                        "description": "«apresentacao» only has data in the main clinic."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SiteAnalytics"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "periodo": {
                                            "de": "2026-09-29",
                                            "ate": "2026-10-28",
                                            "dias": 30,
                                            "area": "todas"
                                        },
                                        "kpis": {
                                            "visitas": 8421,
                                            "visitas_delta": 12.4,
                                            "sessoes": 3120,
                                            "sessoes_delta": 8.1,
                                            "paginas_por_sessao": 2.7,
                                            "telemovel_pct": 71.3,
                                            "pre_avaliacoes": 46,
                                            "conversao_pct": 1.47,
                                            "aceitacao_cookies_pct": 58.2
                                        },
                                        "serie": [
                                            {
                                                "x": "2026-10-28",
                                                "y": 312,
                                                "serie": "Site da clínica"
                                            }
                                        ],
                                        "paginas": [
                                            {
                                                "caminho": "/procedimentos/fue",
                                                "area": "site",
                                                "visitas": 1204,
                                                "sessoes": 980
                                            }
                                        ],
                                        "origens": [
                                            {
                                                "x": "Pesquisa",
                                                "y": 1480
                                            }
                                        ],
                                        "campanhas": [
                                            {
                                                "campanha": "outono",
                                                "fonte": "newsletter",
                                                "meio": "email",
                                                "visitas": 210
                                            }
                                        ],
                                        "dispositivos": [
                                            {
                                                "x": "telemovel",
                                                "y": 6004
                                            }
                                        ],
                                        "idiomas": [
                                            {
                                                "x": "pt",
                                                "y": 7020
                                            }
                                        ],
                                        "conversoes": {
                                            "pre_avaliacoes": 46,
                                            "leads": 128,
                                            "pedidos_demonstracao": null,
                                            "serie": []
                                        },
                                        "cookies": {
                                            "aceitar": 1210,
                                            "rejeitar": 640,
                                            "personalizar": 229,
                                            "total": 2079,
                                            "taxa_aceitacao": 58.2,
                                            "taxa_rejeicao": 30.8,
                                            "categorias": {
                                                "preferencias": 1390,
                                                "estatistica": 1351,
                                                "marketing": 1262
                                            },
                                            "versao_politica": "2"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — analytics"
                ],
                "operationId": "siteAnalytics",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "ver"
            }
        },
        "/site/analytics/ao-vivo": {
            "get": {
                "summary": "Live visits and cookie decisions",
                "description": "Last minutes (5 to 1440; default 60). Designed for refreshing every 15 seconds.",
                "parameters": [
                    {
                        "name": "minutos",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 5,
                            "maximum": 1440
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SiteAoVivo"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "minutos": 60,
                                        "visitas": 84,
                                        "ativos_agora": 6,
                                        "cookies": {
                                            "aceitar": 11,
                                            "rejeitar": 5,
                                            "personalizar": 2,
                                            "total": 18,
                                            "ultimas": [
                                                {
                                                    "id": 20931,
                                                    "decisao": "aceitar",
                                                    "categorias": [
                                                        "preferencias",
                                                        "estatistica",
                                                        "marketing"
                                                    ],
                                                    "em": "2026-10-28T11:41:07+00:00"
                                                }
                                            ]
                                        },
                                        "em": "2026-10-28T11:41:20+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — analytics"
                ],
                "operationId": "siteAnalyticsAoVivo",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "ver"
            }
        },
        "/site/cms/blocos": {
            "get": {
                "summary": "Editable blocks of a page",
                "description": "Catalogue and saved values, in page order. The «apresentacao» page is refused (403): it is managed in the platform area.",
                "parameters": [
                    {
                        "name": "pagina",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]{0,79}$"
                        }
                    },
                    {
                        "name": "idioma",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pt",
                                "en"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/SiteBloco"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "pagina": {
                                                    "type": "string"
                                                },
                                                "idioma": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 214,
                                            "pagina": "inicio",
                                            "chave": "hero_titulo",
                                            "idioma": "pt",
                                            "tipo": "texto",
                                            "seccao": "hero",
                                            "rotulo": "Título principal",
                                            "ajuda": "Use *asteriscos* para o itálico.",
                                            "valor": "Cabelo natural, *plano transparente*.",
                                            "campos": null,
                                            "imagem": null,
                                            "personalizado": true,
                                            "atualizado_em": "2026-10-28 11:20:00",
                                            "ordem": 1
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — CMS"
                ],
                "operationId": "siteCmsBlocos",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "ver"
            },
            "put": {
                "summary": "Save a block",
                "description": "Validated by type: text up to 500 characters; long text up to 12,000; HTML sanitised by tag allowlist; link with https://, mailto:, tel: or a website path; list up to 200 items; image with a library ficheiro_id. Change is audited; the website updates immediately.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "pagina": {
                                        "type": "string"
                                    },
                                    "chave": {
                                        "type": "string"
                                    },
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt",
                                            "en"
                                        ]
                                    },
                                    "valor": {
                                        "description": "According to the block type."
                                    },
                                    "ficheiro_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "pagina",
                                    "chave",
                                    "idioma"
                                ]
                            },
                            "example": {
                                "pagina": "inicio",
                                "chave": "hero_titulo",
                                "idioma": "pt",
                                "valor": "Cabelo natural, *plano transparente*."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SiteBloco"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "pagina": "inicio",
                                        "chave": "hero_titulo",
                                        "idioma": "pt",
                                        "tipo": "texto",
                                        "seccao": "hero",
                                        "rotulo": "Título principal",
                                        "ajuda": "Use *asteriscos* para o itálico.",
                                        "valor": "Cabelo natural, *plano transparente*.",
                                        "campos": null,
                                        "imagem": null,
                                        "personalizado": true,
                                        "atualizado_em": "2026-10-28 11:20:00",
                                        "ordem": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — CMS"
                ],
                "operationId": "siteCmsGuardarBloco",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar"
            }
        },
        "/site/cms/blocos/repor": {
            "post": {
                "summary": "Restore a block's original text",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "pagina": {
                                        "type": "string"
                                    },
                                    "chave": {
                                        "type": "string"
                                    },
                                    "idioma": {
                                        "type": "string",
                                        "enum": [
                                            "pt",
                                            "en"
                                        ]
                                    }
                                },
                                "required": [
                                    "pagina",
                                    "chave",
                                    "idioma"
                                ]
                            },
                            "example": {
                                "pagina": "inicio",
                                "chave": "hero_titulo",
                                "idioma": "pt"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SiteBloco"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 214,
                                        "pagina": "inicio",
                                        "chave": "hero_titulo",
                                        "idioma": "pt",
                                        "tipo": "texto",
                                        "seccao": "hero",
                                        "rotulo": "Título principal",
                                        "ajuda": "Use *asteriscos* para o itálico.",
                                        "valor": "Cirurgia capilar com *planeamento transparente*.",
                                        "campos": null,
                                        "imagem": null,
                                        "personalizado": false,
                                        "atualizado_em": "2026-10-28 11:20:00",
                                        "ordem": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — CMS"
                ],
                "operationId": "siteCmsReporBloco",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar"
            }
        },
        "/site/cms/imagens": {
            "get": {
                "summary": "Website image library",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 100
                        },
                        "description": "Search in name and descriptions."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/SiteImagem"
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 37,
                                            "nome": "9f1c2a7e4b0d4c1e8a3f6b2d5c7e9a10.webp",
                                            "url": "https://clinica.exemplo.pt/uploads/site/c1/9f1c2a7e4b0d4c1e8a3f6b2d5c7e9a10.webp",
                                            "mime": "image/webp",
                                            "largura": 2400,
                                            "altura": 1600,
                                            "tamanho": 318422,
                                            "alt_pt": "Sala de consulta da clínica",
                                            "alt_en": "The clinic's consultation room",
                                            "usos": 2,
                                            "criado_em": "2026-10-28T09:12:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — CMS"
                ],
                "operationId": "siteCmsImagens",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "ver"
            },
            "post": {
                "summary": "Upload an image",
                "description": "Multipart. Only JPEG, PNG, WebP or GIF checked by bytes and dimensions; rewritten without metadata (max 2400 px), random name, public folder with execution disabled. Limit: 60 per 10 minutes.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "alt_pt": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "alt_en": {
                                        "type": "string",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SiteImagem"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 37,
                                        "nome": "9f1c2a7e4b0d4c1e8a3f6b2d5c7e9a10.webp",
                                        "url": "https://clinica.exemplo.pt/uploads/site/c1/9f1c2a7e4b0d4c1e8a3f6b2d5c7e9a10.webp",
                                        "mime": "image/webp",
                                        "largura": 2400,
                                        "altura": 1600,
                                        "tamanho": 318422,
                                        "alt_pt": "Sala de consulta da clínica",
                                        "alt_en": "The clinic's consultation room",
                                        "usos": 2,
                                        "criado_em": "2026-10-28T09:12:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — CMS"
                ],
                "operationId": "siteCmsCarregarImagem",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar"
            }
        },
        "/site/cms/imagens/{id}": {
            "put": {
                "summary": "Change an image's descriptions",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "alt_pt": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "alt_en": {
                                        "type": "string",
                                        "maxLength": 255
                                    }
                                }
                            },
                            "example": {
                                "alt_pt": "Sala de consulta",
                                "alt_en": "Consultation room"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SiteImagem"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 37,
                                        "nome": "9f1c2a7e4b0d4c1e8a3f6b2d5c7e9a10.webp",
                                        "url": "https://clinica.exemplo.pt/uploads/site/c1/9f1c2a7e4b0d4c1e8a3f6b2d5c7e9a10.webp",
                                        "mime": "image/webp",
                                        "largura": 2400,
                                        "altura": 1600,
                                        "tamanho": 318422,
                                        "alt_pt": "Sala de consulta da clínica",
                                        "alt_en": "The clinic's consultation room",
                                        "usos": 2,
                                        "criado_em": "2026-10-28T09:12:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — CMS"
                ],
                "operationId": "siteCmsDescricaoImagem",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar"
            },
            "delete": {
                "summary": "Delete an unused image",
                "description": "Refused (422) if the image is used in a block or page.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "apagada": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 37,
                                        "apagada": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — CMS"
                ],
                "operationId": "siteCmsApagarImagem",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar"
            }
        },
        "/site/cms/paginas": {
            "get": {
                "summary": "The clinic's website pages",
                "description": "All pages of the current clinic with status per language and number of customised blocks.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/SitePaginaEditor"
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "chave": "inicio",
                                            "tipo": "institucional",
                                            "ordem": 0,
                                            "idiomas": {
                                                "pt": {
                                                    "id": 1,
                                                    "titulo": "Início",
                                                    "slug": "inicio",
                                                    "publicada": true,
                                                    "versao": 3,
                                                    "publicada_em": "2026-10-28 10:00:00",
                                                    "atualizado_em": "2026-10-28 10:00:00"
                                                }
                                            },
                                            "blocos": 24,
                                            "personalizados": {
                                                "pt": 6,
                                                "en": 2
                                            },
                                            "url": "https://clinica.exemplo.pt/"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — CMS"
                ],
                "operationId": "siteCmsPaginas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "ver"
            }
        },
        "/site/cms/paginas/{id}/publicar": {
            "post": {
                "summary": "Publish or unpublish a page",
                "description": "publicar = true (default) publishes; false removes it from the website. With new content, an immutable version with a fingerprint (SHA-256) is created. Publishing the Cookie Policy increases the policy version and the banner asks again.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "publicar": {
                                        "type": "boolean"
                                    },
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255
                                    }
                                }
                            },
                            "example": {
                                "publicar": true,
                                "motivo": "Atualização dos dados do encarregado de proteção de dados"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "publicada": {
                                                    "type": "boolean"
                                                },
                                                "versao": {
                                                    "type": "integer"
                                                },
                                                "publicada_em": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 12,
                                        "publicada": true,
                                        "versao": 4,
                                        "publicada_em": "2026-10-28T11:30:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — CMS"
                ],
                "operationId": "siteCmsPublicar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar"
            }
        },
        "/site/cms/paginas/{id}/versoes": {
            "get": {
                "summary": "Published versions of a page",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/SiteVersao"
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 33,
                                            "versao": 4,
                                            "titulo": "Política de Privacidade",
                                            "conteudo_hash": "5b0e1f…c2a9",
                                            "motivo": "Atualização dos dados do encarregado de proteção de dados",
                                            "criado_por": 3,
                                            "criado_em": "2026-10-28T11:30:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — CMS"
                ],
                "operationId": "siteCmsVersoes",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "ver"
            }
        },
        "/site/incorporacao": {
            "get": {
                "summary": "Assessment on other websites: status and code",
                "description": "Authorised websites, the line of code to paste (Portuguese, English and with container) and the embedded page and preview addresses. The embedded page can only be framed by the authorised websites (frame-ancestors) and only sends height messages to the validated origin.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SiteIncorporacao"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ativa": true,
                                        "ligada": true,
                                        "pre_avaliacao_ativa": true,
                                        "dominios": [
                                            "https://www.clinica.pt"
                                        ],
                                        "invalidos": [],
                                        "codigo_clinica": "PORTO-HAIR",
                                        "url_script": "https://plataforma.exemplo.pt/assets/ax/js/incorporar-pre-avaliacao.js",
                                        "url_pagina": "https://plataforma.exemplo.pt/incorporar/pre-avaliacao?idioma=pt&clinica=PORTO-HAIR",
                                        "codigo": "<script src=\"https://plataforma.exemplo.pt/assets/ax/js/incorporar-pre-avaliacao.js\" data-anagen-pre-avaliacao data-clinica=\"PORTO-HAIR\" data-idioma=\"pt\" async></script>"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — incorporação"
                ],
                "operationId": "siteIncorporacao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "ver"
            },
            "put": {
                "summary": "Switch on and authorise websites",
                "description": "ativa switches embedding on (requires at least one website); dominios accepts https://domain, domain or *.domain (up to 20). An invalid address refuses the request (422). Change is audited.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "ativa": {
                                        "type": "boolean"
                                    },
                                    "dominios": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "required": [
                                    "ativa",
                                    "dominios"
                                ]
                            },
                            "example": {
                                "ativa": true,
                                "dominios": [
                                    "https://www.clinica.pt",
                                    "*.clinica.pt"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/SiteIncorporacao"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ativa": true,
                                        "ligada": true,
                                        "dominios": [
                                            "https://www.clinica.pt",
                                            "https://*.clinica.pt"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — incorporação"
                ],
                "operationId": "siteIncorporacaoGravar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "site.cms",
                "x-anagen-nivel": "editar"
            }
        },
        "/site/pre-avaliacoes/{id}": {
            "get": {
                "summary": "Online assessment for review",
                "description": "The list, filters and export come from the generic pre_avaliacoes resource (/r/pre_avaliacoes). This detail adds the photos (ficha.fotografias, 30-min links) and the answers, triage and medical note (ficha.clinica). The first opening by a reviewer sets the status to «em_revisao». Read is audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PreAvaliacaoDetalhe"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 91,
                                        "nome": "João Costa",
                                        "email": "joao.costa@exemplo.pt",
                                        "telefone": "+351 913 222 111",
                                        "pais": "PT",
                                        "lead_id": 402,
                                        "idioma": "pt",
                                        "origem": "app",
                                        "estado": "em_revisao",
                                        "estado_rotulo": "Em revisão",
                                        "procedimento": "couro_cabeludo",
                                        "procedimento_rotulo": "Couro cabeludo",
                                        "triagem": "elegivel_provavel",
                                        "triagem_rotulo": "Seguir para consulta",
                                        "parecer": null,
                                        "parecer_rotulo": null,
                                        "nota_medica": null,
                                        "consentimentos": {
                                            "tratamento_clinico": true,
                                            "fotografias_clinicas": true,
                                            "contacto": true,
                                            "marketing": false
                                        },
                                        "fotos": [
                                            {
                                                "ficheiro_id": 8801,
                                                "vista": "frontal",
                                                "url": "https://clinica.exemplo.pt/f/eyJmIjo4ODAxLC….a9c"
                                            }
                                        ],
                                        "respostas": [
                                            {
                                                "chave": "tempo_queda",
                                                "rotulo": "Há quanto tempo nota a queda?",
                                                "valor": "3 a 5 anos"
                                            }
                                        ],
                                        "revisto_por": null,
                                        "revisto_em": null,
                                        "respondido_em": null,
                                        "criado_em": "2026-10-28T08:05:00+00:00",
                                        "pode": {
                                            "rever": true,
                                            "responder": false,
                                            "fotos": true,
                                            "respostas": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — pré-avaliações"
                ],
                "operationId": "sitePreAvaliacaoDetalhe",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "ver"
            }
        },
        "/site/pre-avaliacoes/{id}/resposta": {
            "post": {
                "summary": "Send the reply to the person",
                "description": "Requires crm.atendimento (edit) and the «revista» status (422 before medical review). Sends the email with the next step for the opinion, without clinical details, and sets «respondida».",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "mensagem": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 2000
                                    }
                                }
                            },
                            "example": {
                                "mensagem": "Temos vagas na próxima semana, de manhã."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PreAvaliacaoDetalhe"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 91,
                                        "nome": "João Costa",
                                        "email": "joao.costa@exemplo.pt",
                                        "telefone": "+351 913 222 111",
                                        "pais": "PT",
                                        "lead_id": 402,
                                        "idioma": "pt",
                                        "origem": "app",
                                        "estado": "respondida",
                                        "estado_rotulo": "Respondida",
                                        "procedimento": "couro_cabeludo",
                                        "procedimento_rotulo": "Couro cabeludo",
                                        "triagem": "elegivel_provavel",
                                        "triagem_rotulo": "Seguir para consulta",
                                        "parecer": null,
                                        "parecer_rotulo": null,
                                        "nota_medica": null,
                                        "consentimentos": {
                                            "tratamento_clinico": true,
                                            "fotografias_clinicas": true,
                                            "contacto": true,
                                            "marketing": false
                                        },
                                        "fotos": [
                                            {
                                                "ficheiro_id": 8801,
                                                "vista": "frontal",
                                                "url": "https://clinica.exemplo.pt/f/eyJmIjo4ODAxLC….a9c"
                                            }
                                        ],
                                        "respostas": [
                                            {
                                                "chave": "tempo_queda",
                                                "rotulo": "Há quanto tempo nota a queda?",
                                                "valor": "3 a 5 anos"
                                            }
                                        ],
                                        "revisto_por": null,
                                        "revisto_em": null,
                                        "respondido_em": "2026-10-28T12:30:00+00:00",
                                        "criado_em": "2026-10-28T08:05:00+00:00",
                                        "pode": {
                                            "rever": true,
                                            "responder": false,
                                            "fotos": true,
                                            "respostas": true
                                        },
                                        "email_enviado": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — pré-avaliações"
                ],
                "operationId": "sitePreAvaliacaoResposta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-nivel": "editar"
            }
        },
        "/site/pre-avaliacoes/{id}/revista": {
            "post": {
                "summary": "Medical review",
                "description": "Requires ficha.clinica (edit). Stores the opinion and the medical note (encrypted), completes the review task, validates the clinical form response and notifies reception (no clinical content).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "parecer": {
                                        "type": "string",
                                        "enum": [
                                            "consulta",
                                            "teleconsulta",
                                            "mais_fotos",
                                            "nao_elegivel",
                                            "outro"
                                        ]
                                    },
                                    "nota": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 4000
                                    }
                                },
                                "required": [
                                    "parecer"
                                ]
                            },
                            "example": {
                                "parecer": "consulta",
                                "nota": "Boa zona dadora; avaliar a coroa em consulta."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/PreAvaliacaoDetalhe"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 91,
                                        "nome": "João Costa",
                                        "email": "joao.costa@exemplo.pt",
                                        "telefone": "+351 913 222 111",
                                        "pais": "PT",
                                        "lead_id": 402,
                                        "idioma": "pt",
                                        "origem": "app",
                                        "estado": "revista",
                                        "estado_rotulo": "Revista",
                                        "procedimento": "couro_cabeludo",
                                        "procedimento_rotulo": "Couro cabeludo",
                                        "triagem": "elegivel_provavel",
                                        "triagem_rotulo": "Seguir para consulta",
                                        "parecer": "consulta",
                                        "parecer_rotulo": "Marcar consulta presencial",
                                        "nota_medica": null,
                                        "consentimentos": {
                                            "tratamento_clinico": true,
                                            "fotografias_clinicas": true,
                                            "contacto": true,
                                            "marketing": false
                                        },
                                        "fotos": [
                                            {
                                                "ficheiro_id": 8801,
                                                "vista": "frontal",
                                                "url": "https://clinica.exemplo.pt/f/eyJmIjo4ODAxLC….a9c"
                                            }
                                        ],
                                        "respostas": [
                                            {
                                                "chave": "tempo_queda",
                                                "rotulo": "Há quanto tempo nota a queda?",
                                                "valor": "3 a 5 anos"
                                            }
                                        ],
                                        "revisto_por": 7,
                                        "revisto_em": "2026-10-28T12:02:00+00:00",
                                        "respondido_em": null,
                                        "criado_em": "2026-10-28T08:05:00+00:00",
                                        "pode": {
                                            "rever": true,
                                            "responder": false,
                                            "fotos": true,
                                            "respostas": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                },
                "tags": [
                    "Site — pré-avaliações"
                ],
                "operationId": "sitePreAvaliacaoRevista",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar"
            }
        },
        "/stock/alertas": {
            "get": {
                "tags": [
                    "Stock"
                ],
                "operationId": "m5StockAlertas",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "ver",
                "summary": "Stock alerts",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "abaixo_minimo": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "nome": {
                                                                "type": "string"
                                                            },
                                                            "referencia": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "categoria": {
                                                                "type": "string"
                                                            },
                                                            "unidade": {
                                                                "type": "string"
                                                            },
                                                            "stock_atual": {
                                                                "type": "number"
                                                            },
                                                            "stock_minimo": {
                                                                "type": "number"
                                                            },
                                                            "fornecedor": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                },
                                                "validades": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "artigo_id": {
                                                                "type": "integer"
                                                            },
                                                            "artigo": {
                                                                "type": "string"
                                                            },
                                                            "lote": {
                                                                "type": "string"
                                                            },
                                                            "validade": {
                                                                "type": "string",
                                                                "format": "date"
                                                            },
                                                            "quantidade": {
                                                                "type": "number"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/stock/cirurgias/{id}/consumos": {
            "get": {
                "tags": [
                    "Stock"
                ],
                "operationId": "m5ConsumosCirurgia",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "ver",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Consumption of a surgery",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M5Consumo"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Stock"
                ],
                "operationId": "m5ConsumosRegistar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "stock:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "stock",
                "x-anagen-nivel": "editar",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "summary": "Record consumption (Consumos::registarCirurgia)",
                "description": "Idempotent per surgery: replaces consumption not yet posted. Requires a batch for items with mandatory batch. Effects: consumption stock-outs linked to the surgery and patient, minimum alerts.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "linhas": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "artigo_id",
                                                "quantidade"
                                            ],
                                            "properties": {
                                                "artigo_id": {
                                                    "type": "integer"
                                                },
                                                "quantidade": {
                                                    "type": "number"
                                                },
                                                "lote": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "validade": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "notas": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "linhas"
                                ]
                            },
                            "example": {
                                "linhas": [
                                    {
                                        "artigo_id": 5,
                                        "quantidade": 2,
                                        "lote": "L2611A",
                                        "validade": "2027-05-31"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M5Consumo"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/subscricao/confirmar/{codigo}": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Chat do site e subscrições"
                ],
                "operationId": "subscricaoConfirmar",
                "security": [],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "publico",
                "summary": "Confirm the subscription (double opt-in)",
                "description": "Link in the «Confirm your subscription» email. Records the marketing consent with date and source and marks the subscription as confirmed. Single-use code.",
                "parameters": [
                    {
                        "name": "codigo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{16,128}$"
                        },
                        "description": "Confirmation code"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Confirmation page",
                        "content": {
                            "text/html": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/subscricao/{codigo}": {
            "servers": [
                {
                    "url": "https://anagen.pt",
                    "description": "Clinic site root (outside /api/v1)"
                }
            ],
            "get": {
                "tags": [
                    "Chat do site e subscrições"
                ],
                "operationId": "subscricaoPagina",
                "security": [],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "publico",
                "summary": "«Unsubscribe» page",
                "description": "HTML page to confirm the unsubscribe. Clinic and contact come from the send record.",
                "parameters": [
                    {
                        "name": "codigo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{16,128}$"
                        },
                        "description": "Send code"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page",
                        "content": {
                            "text/html": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Chat do site e subscrições"
                ],
                "operationId": "subscricaoAnular",
                "security": [],
                "x-anagen-modulo": "marketing",
                "x-anagen-nivel": "publico",
                "summary": "Confirm «Unsubscribe»",
                "description": "Page form (with the CSRF code). Effects: channel opt-out list, marketing consent revoked, commercial sequences stopped, unsubscribe count.",
                "parameters": [
                    {
                        "name": "codigo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{16,128}$"
                        },
                        "description": "Send code"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Confirmation page",
                        "content": {
                            "text/html": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/tarefas": {
            "get": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "listarTarefas",
                "summary": "Tasks by view",
                "description": "Views: minhas (grouped overdue, today, upcoming, no due date), equipa (matrix scope), quadro (open, in progress, completed in the last 7 days) and concluidas.\n\nScope equipa.tarefas: «own» = mine, my department's unassigned ones and those I created; «team» adds my teams'; «all» = whole clinic. Patient, lead and surgery names only for those who may see those modules.",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "vista",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "minhas",
                                "equipa",
                                "quadro",
                                "concluidas"
                            ],
                            "default": "minhas"
                        },
                        "description": "View."
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Search title and description."
                    },
                    {
                        "name": "prioridade",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "baixa",
                                "normal",
                                "alta",
                                "urgente"
                            ]
                        },
                        "description": "Priority."
                    },
                    {
                        "name": "origem",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "manual",
                                "automatica",
                                "mensagem",
                                "agente"
                            ]
                        },
                        "description": "Origin."
                    },
                    {
                        "name": "responsavel_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Assignee."
                    },
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient."
                    },
                    {
                        "name": "lead_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Lead."
                    },
                    {
                        "name": "cirurgia_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Surgery."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/ListaTarefas"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "vista": "minhas",
                                        "grupos": [
                                            {
                                                "chave": "hoje",
                                                "titulo": "Hoje",
                                                "tom": "marca",
                                                "tarefas": [
                                                    {
                                                        "id": 87,
                                                        "titulo": "Ligar à Rita Matos para confirmar a consulta",
                                                        "descricao": null,
                                                        "tipo": "geral",
                                                        "prioridade": "alta",
                                                        "prioridade_rotulo": "Alta",
                                                        "estado": "aberta",
                                                        "estado_rotulo": "Aberta",
                                                        "origem": "manual",
                                                        "origem_rotulo": "Manual",
                                                        "prazo": "2026-10-29T10:00:00+00:00",
                                                        "em_atraso": false,
                                                        "responsavel_id": 4,
                                                        "responsavel_nome": "Ana Sousa",
                                                        "paciente_id": 41,
                                                        "paciente_nome": "Rita Matos",
                                                        "lead_id": null,
                                                        "cirurgia_id": null,
                                                        "checklist": {
                                                            "total": 3,
                                                            "feitos": 1
                                                        },
                                                        "itens": [
                                                            {
                                                                "id": 5,
                                                                "texto": "Confirmar morada",
                                                                "feito": true,
                                                                "obrigatorio": false,
                                                                "responsavel_nome": null
                                                            }
                                                        ],
                                                        "criado_em": "2026-10-28T09:12:00+00:00"
                                                    }
                                                ]
                                            }
                                        ],
                                        "total": 1,
                                        "contagens": {
                                            "hoje": 1,
                                            "atraso": 0,
                                            "abertas": 4,
                                            "equipa": 12
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "criarTarefa",
                "summary": "Create task (with checklist)",
                "description": "Quick create: the title understands «!urgente|!alta|!baixa» (priority), «hoje»/«amanhã» (today/tomorrow at 18:00) and «@Name» (assignee). Without assignee or department, the task goes to its creator. The assignee (or department) is notified.\n\nEffects: webhook tarefa.criada; audit log.",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/NovaTarefa"
                            },
                            "example": {
                                "titulo": "Pedir análises pré-operatórias amanhã !alta",
                                "responsavel_id": 4,
                                "paciente_id": 41,
                                "itens": [
                                    "Hemograma",
                                    "Coagulação",
                                    "ECG"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Tarefa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 87,
                                        "titulo": "Ligar à Rita Matos para confirmar a consulta",
                                        "descricao": null,
                                        "tipo": "geral",
                                        "prioridade": "alta",
                                        "prioridade_rotulo": "Alta",
                                        "estado": "aberta",
                                        "estado_rotulo": "Aberta",
                                        "origem": "manual",
                                        "origem_rotulo": "Manual",
                                        "prazo": "2026-10-29T10:00:00+00:00",
                                        "em_atraso": false,
                                        "responsavel_id": 4,
                                        "responsavel_nome": "Ana Sousa",
                                        "paciente_id": 41,
                                        "paciente_nome": "Rita Matos",
                                        "lead_id": null,
                                        "cirurgia_id": null,
                                        "checklist": {
                                            "total": 3,
                                            "feitos": 1
                                        },
                                        "itens": [
                                            {
                                                "id": 5,
                                                "texto": "Confirmar morada",
                                                "feito": true,
                                                "obrigatorio": false,
                                                "responsavel_nome": null
                                            }
                                        ],
                                        "criado_em": "2026-10-28T09:12:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/tarefas/contagens": {
            "get": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "contarTarefas",
                "summary": "Counts (today, overdue, open, team)",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:ver"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "hoje": {
                                                    "type": "integer"
                                                },
                                                "atraso": {
                                                    "type": "integer"
                                                },
                                                "abertas": {
                                                    "type": "integer"
                                                },
                                                "equipa": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "hoje": 3,
                                        "atraso": 1,
                                        "abertas": 9,
                                        "equipa": 27
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/tarefas/{id}": {
            "get": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "obterTarefa",
                "summary": "Get task with checklist",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Tarefa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 87,
                                        "titulo": "Ligar à Rita Matos para confirmar a consulta",
                                        "descricao": null,
                                        "tipo": "geral",
                                        "prioridade": "alta",
                                        "prioridade_rotulo": "Alta",
                                        "estado": "aberta",
                                        "estado_rotulo": "Aberta",
                                        "origem": "manual",
                                        "origem_rotulo": "Manual",
                                        "prazo": "2026-10-29T10:00:00+00:00",
                                        "em_atraso": false,
                                        "responsavel_id": 4,
                                        "responsavel_nome": "Ana Sousa",
                                        "paciente_id": 41,
                                        "paciente_nome": "Rita Matos",
                                        "lead_id": null,
                                        "cirurgia_id": null,
                                        "checklist": {
                                            "total": 3,
                                            "feitos": 1
                                        },
                                        "itens": [
                                            {
                                                "id": 5,
                                                "texto": "Confirmar morada",
                                                "feito": true,
                                                "obrigatorio": false,
                                                "responsavel_nome": null
                                            }
                                        ],
                                        "criado_em": "2026-10-28T09:12:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            },
            "put": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "alterarTarefa",
                "summary": "Update task",
                "description": "Partial update (only fields sent). «estado» accepts aberta, em_curso or cancelada; to complete use /concluir. Changing the assignee notifies the new person.",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AlterarTarefa"
                            },
                            "example": {
                                "prazo": "2026-10-30T12:00:00+00:00",
                                "estado": "em_curso"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Tarefa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 87,
                                        "titulo": "Ligar à Rita Matos para confirmar a consulta",
                                        "descricao": null,
                                        "tipo": "geral",
                                        "prioridade": "alta",
                                        "prioridade_rotulo": "Alta",
                                        "estado": "aberta",
                                        "estado_rotulo": "Aberta",
                                        "origem": "manual",
                                        "origem_rotulo": "Manual",
                                        "prazo": "2026-10-29T10:00:00+00:00",
                                        "em_atraso": false,
                                        "responsavel_id": 4,
                                        "responsavel_nome": "Ana Sousa",
                                        "paciente_id": 41,
                                        "paciente_nome": "Rita Matos",
                                        "lead_id": null,
                                        "cirurgia_id": null,
                                        "checklist": {
                                            "total": 3,
                                            "feitos": 1
                                        },
                                        "itens": [
                                            {
                                                "id": 5,
                                                "texto": "Confirmar morada",
                                                "feito": true,
                                                "obrigatorio": false,
                                                "responsavel_nome": null
                                            }
                                        ],
                                        "criado_em": "2026-10-28T09:12:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/tarefas/{id}/concluir": {
            "post": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "concluirTarefa",
                "summary": "Complete task",
                "description": "Refused (422) while required checklist items are pending. Effects: webhook tarefa.concluida; audit. Undo: /reabrir.",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Tarefa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/tarefas/{id}/itens": {
            "post": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "acrescentarItemDaChecklist",
                "summary": "Add checklist item",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "texto"
                                ],
                                "properties": {
                                    "texto": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "responsavel_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "obrigatorio": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "texto": "Confirmar jejum de 6 h",
                                "responsavel_id": 9,
                                "obrigatorio": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/ItemChecklist"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/tarefas/{id}/itens/ordem": {
            "put": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "ordenarItensDaChecklist",
                "summary": "Reorder the checklist",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ids"
                                ],
                                "properties": {
                                    "ids": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    }
                                }
                            },
                            "example": {
                                "ids": [
                                    7,
                                    5,
                                    6
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/ItemChecklist"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/tarefas/{id}/itens/{item}": {
            "delete": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "retirarItemDaChecklist",
                "summary": "Remove item",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "name": "item",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Checklist item"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/ItemChecklist"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/tarefas/{id}/itens/{item}/alternar": {
            "post": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "alternarItemDaChecklist",
                "summary": "Check/uncheck item",
                "description": "Without body it toggles; with {\"feito\": true|false} it sets. Records who and when.",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "name": "item",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Checklist item"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/ItemChecklist"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/tarefas/{id}/mover": {
            "post": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "moverTarefa",
                "summary": "Move to another board column",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "estado"
                                ],
                                "properties": {
                                    "estado": {
                                        "type": "string",
                                        "enum": [
                                            "aberta",
                                            "em_curso",
                                            "concluida"
                                        ]
                                    }
                                }
                            },
                            "example": {
                                "estado": "em_curso"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Tarefa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/tarefas/{id}/reabrir": {
            "post": {
                "tags": [
                    "Tarefas"
                ],
                "operationId": "reabrirTarefa",
                "summary": "Reopen task (undo)",
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "equipa.tarefas:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/Tarefa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/teleconsultas": {
            "get": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6ListarTeleconsultas",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "ver",
                "summary": "Teleconsultations of a day or range",
                "description": "Within the «teleconsulta» module scope (doctor: their own and those of their patients), excluding cancelled or rescheduled appointments, by time (up to 200). «relatorio_ok» tells whether a report exists, without showing it.",
                "parameters": [
                    {
                        "name": "data",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Day (default today)."
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Last day of the range (optional)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M6TeleconsultaLinha"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 55,
                                            "marcacao_id": 8850,
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "medico_id": 7,
                                            "medico_nome": "Inês Valente",
                                            "inicio": "2026-11-04T18:00:00+00:00",
                                            "fim": "2026-11-04T18:30:00+00:00",
                                            "estado": "sala_espera",
                                            "estado_rotulo": "Na sala de espera",
                                            "estado_tom": "aviso",
                                            "sala_espera_em": "2026-11-04T17:56:10+00:00",
                                            "relatorio_ok": false
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}": {
            "get": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6ObterTeleconsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "ver",
                "summary": "Teleconsultation detail",
                "description": "Status, steps (consent, waiting room, admission, identity, attendees, report, closing), valid consents, attendees, host address of the video room (only to those who can run the session), captures, report and attendance-proof files and the clinic approved consent text to read to the patient. The report and captures are only returned to users with access to the patient clinical record («ficha.clinica»), with the read audited.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/M6Teleconsulta"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "consentimento_texto": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "titulo": {
                                                                    "type": "string"
                                                                },
                                                                "texto": {
                                                                    "type": "string",
                                                                    "description": "HTML of the approved template."
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            ]
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 55,
                                        "marcacao_id": 8850,
                                        "estado": "em_curso",
                                        "estado_rotulo": "Em curso",
                                        "estado_tom": "marca",
                                        "inicio": "2026-11-04T18:00:00+00:00",
                                        "fim": "2026-11-04T18:30:00+00:00",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "medico_id": 7,
                                        "medico_nome": "Inês Valente",
                                        "consentimento": true,
                                        "consentimento_gravacao": false,
                                        "gravacao_permitida": false,
                                        "sala_espera_em": "2026-11-04T17:56:10+00:00",
                                        "admitido_em": "2026-11-04T18:01:02+00:00",
                                        "identidade_metodo": "documento",
                                        "identidade_confirmada_em": "2026-11-04T18:02:30+00:00",
                                        "identidade_confirmada_por": "Inês Valente",
                                        "presentes": [
                                            {
                                                "nome": "Rui Almeida",
                                                "papel": "paciente",
                                                "relacao": "",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            },
                                            {
                                                "nome": "Sofia Almeida",
                                                "papel": "acompanhante",
                                                "relacao": "Cônjuge",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            }
                                        ],
                                        "video_configurado": true,
                                        "sala_url": "https://video.clinica.pt/tc-1-55?papel=anfitriao&t=9f2c7a1e",
                                        "inicio_real": "2026-11-04T18:01:02+00:00",
                                        "fim_real": null,
                                        "relatorio_visivel": true,
                                        "relatorio": null,
                                        "relatorio_origem": null,
                                        "relatorio_fechado_em": null,
                                        "comprovativo_ficheiro_id": null,
                                        "relatorio_ficheiro_id": null,
                                        "capturas": [
                                            {
                                                "ficheiro_id": 7781,
                                                "criado_em": "2026-11-04T18:12:40+00:00"
                                            }
                                        ],
                                        "assistente": true,
                                        "pode_editar": true,
                                        "passos": [
                                            {
                                                "chave": "consentimento",
                                                "feito": true
                                            },
                                            {
                                                "chave": "sala_espera",
                                                "feito": true
                                            },
                                            {
                                                "chave": "admitido",
                                                "feito": true
                                            },
                                            {
                                                "chave": "identidade",
                                                "feito": true
                                            },
                                            {
                                                "chave": "presentes",
                                                "feito": true
                                            },
                                            {
                                                "chave": "relatorio",
                                                "feito": false
                                            },
                                            {
                                                "chave": "fechada",
                                                "feito": false
                                            }
                                        ],
                                        "consentimento_texto": {
                                            "titulo": "Consentimento para teleconsulta",
                                            "texto": "<p>Autorizo a realização da consulta por videoconsulta e fui informado(a) das suas limitações.</p>"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/admitir": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6AdmitirTeleconsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Admit the patient and start the session",
                "description": "Requires a valid teleconsultation consent (422 «consentimento_em_falta»). Creates the room on the video service from Settings (once; the host address is stored encrypted; 503 «video_indisponivel» if the service fails) and starts the session: only from now on does the patient receive the room address. Ended or closed teleconsultation → 409. Effects: appointment in progress with check-in, appointment history and audit.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Teleconsulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 55,
                                        "marcacao_id": 8850,
                                        "estado": "em_curso",
                                        "estado_rotulo": "Em curso",
                                        "estado_tom": "marca",
                                        "inicio": "2026-11-04T18:00:00+00:00",
                                        "fim": "2026-11-04T18:30:00+00:00",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "medico_id": 7,
                                        "medico_nome": "Inês Valente",
                                        "consentimento": true,
                                        "consentimento_gravacao": false,
                                        "gravacao_permitida": false,
                                        "sala_espera_em": "2026-11-04T17:56:10+00:00",
                                        "admitido_em": "2026-11-04T18:01:02+00:00",
                                        "identidade_metodo": "documento",
                                        "identidade_confirmada_em": "2026-11-04T18:02:30+00:00",
                                        "identidade_confirmada_por": "Inês Valente",
                                        "presentes": [
                                            {
                                                "nome": "Rui Almeida",
                                                "papel": "paciente",
                                                "relacao": "",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            },
                                            {
                                                "nome": "Sofia Almeida",
                                                "papel": "acompanhante",
                                                "relacao": "Cônjuge",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            }
                                        ],
                                        "video_configurado": true,
                                        "sala_url": "https://video.clinica.pt/tc-1-55?papel=anfitriao&t=9f2c7a1e",
                                        "inicio_real": "2026-11-04T18:01:02+00:00",
                                        "fim_real": null,
                                        "relatorio_visivel": true,
                                        "relatorio": null,
                                        "relatorio_origem": null,
                                        "relatorio_fechado_em": null,
                                        "comprovativo_ficheiro_id": null,
                                        "relatorio_ficheiro_id": null,
                                        "capturas": [
                                            {
                                                "ficheiro_id": 7781,
                                                "criado_em": "2026-11-04T18:12:40+00:00"
                                            }
                                        ],
                                        "assistente": true,
                                        "pode_editar": true,
                                        "passos": [
                                            {
                                                "chave": "consentimento",
                                                "feito": true
                                            },
                                            {
                                                "chave": "sala_espera",
                                                "feito": true
                                            },
                                            {
                                                "chave": "admitido",
                                                "feito": true
                                            },
                                            {
                                                "chave": "identidade",
                                                "feito": true
                                            },
                                            {
                                                "chave": "presentes",
                                                "feito": true
                                            },
                                            {
                                                "chave": "relatorio",
                                                "feito": false
                                            },
                                            {
                                                "chave": "fechada",
                                                "feito": false
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Não é possível neste estado."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Business rule (consentimento_em_falta)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "consentimento_em_falta": {
                                        "summary": "consentimento_em_falta",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "consentimento_em_falta",
                                                "mensagem": "O paciente ainda não deu o consentimento para a teleconsulta.",
                                                "campos": {
                                                    "consentimento": "O paciente ainda não deu o consentimento para a teleconsulta."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "Business rule (video_indisponivel)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "video_indisponivel": {
                                        "summary": "video_indisponivel",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "video_indisponivel",
                                                "mensagem": "Não foi possível criar a sala de vídeo. Tente de novo."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/captura": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6CapturaTeleconsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Save a video consultation capture",
                "description": "Image validated by content, random name, location metadata removed, stored as an encrypted clinical file of the patient; enters the clinical gallery as «to verify» when the planning module exists. Requires «teleconsulta» edit and access to the patient clinical record. Returns a 15-minute signed link.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "Image (JPEG, PNG or WebP)."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6FicheiroLigacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ficheiro_id": 7781,
                                        "url": "https://clinica.pt/api/v1/ficheiros/7781/conteudo?assinatura=4f9a2c&expira=1793817600"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/consentimento": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6ConsentimentoTeleconsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Record the consent given to the team",
                "description": "Records in the core consent registry (decision «given», approved version of the clinic template) the teleconsultation or recording consent given orally, in person, by email or on the portal. The patient can also give it when joining the waiting room. No patient → 422.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "finalidade": {
                                        "type": "string",
                                        "enum": [
                                            "teleconsulta",
                                            "gravacao_video"
                                        ],
                                        "default": "teleconsulta"
                                    },
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "telefone",
                                            "presencial",
                                            "email",
                                            "portal"
                                        ],
                                        "default": "telefone"
                                    }
                                },
                                "required": [
                                    "finalidade"
                                ]
                            },
                            "example": {
                                "finalidade": "teleconsulta",
                                "canal": "telefone"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Teleconsulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 55,
                                        "marcacao_id": 8850,
                                        "estado": "em_curso",
                                        "estado_rotulo": "Em curso",
                                        "estado_tom": "marca",
                                        "inicio": "2026-11-04T18:00:00+00:00",
                                        "fim": "2026-11-04T18:30:00+00:00",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "medico_id": 7,
                                        "medico_nome": "Inês Valente",
                                        "consentimento": true,
                                        "consentimento_gravacao": false,
                                        "gravacao_permitida": false,
                                        "sala_espera_em": "2026-11-04T17:56:10+00:00",
                                        "admitido_em": "2026-11-04T18:01:02+00:00",
                                        "identidade_metodo": "documento",
                                        "identidade_confirmada_em": "2026-11-04T18:02:30+00:00",
                                        "identidade_confirmada_por": "Inês Valente",
                                        "presentes": [
                                            {
                                                "nome": "Rui Almeida",
                                                "papel": "paciente",
                                                "relacao": "",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            },
                                            {
                                                "nome": "Sofia Almeida",
                                                "papel": "acompanhante",
                                                "relacao": "Cônjuge",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            }
                                        ],
                                        "video_configurado": true,
                                        "sala_url": "https://video.clinica.pt/tc-1-55?papel=anfitriao&t=9f2c7a1e",
                                        "inicio_real": "2026-11-04T18:01:02+00:00",
                                        "fim_real": null,
                                        "relatorio_visivel": true,
                                        "relatorio": null,
                                        "relatorio_origem": null,
                                        "relatorio_fechado_em": null,
                                        "comprovativo_ficheiro_id": null,
                                        "relatorio_ficheiro_id": null,
                                        "capturas": [
                                            {
                                                "ficheiro_id": 7781,
                                                "criado_em": "2026-11-04T18:12:40+00:00"
                                            }
                                        ],
                                        "assistente": true,
                                        "pode_editar": true,
                                        "passos": [
                                            {
                                                "chave": "consentimento",
                                                "feito": true
                                            },
                                            {
                                                "chave": "sala_espera",
                                                "feito": true
                                            },
                                            {
                                                "chave": "admitido",
                                                "feito": true
                                            },
                                            {
                                                "chave": "identidade",
                                                "feito": true
                                            },
                                            {
                                                "chave": "presentes",
                                                "feito": true
                                            },
                                            {
                                                "chave": "relatorio",
                                                "feito": false
                                            },
                                            {
                                                "chave": "fechada",
                                                "feito": false
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/fechar": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6FecharTeleconsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Close the teleconsultation",
                "description": "Only closes with a report (422 «relatorio_em_falta»). Generates the report document (clinical, encrypted, shared with the patient) and the attendance proof (document from the documents module when it exists; otherwise its own file), marks the appointment as completed, records a clinical timeline event and notifies the patient that the report is available on the portal. Requires «teleconsulta» edit and clinical record access. Already closed → 409. Effects: audit.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Teleconsulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 55,
                                        "marcacao_id": 8850,
                                        "estado": "fechada",
                                        "estado_rotulo": "Fechada",
                                        "estado_tom": "sucesso",
                                        "inicio": "2026-11-04T18:00:00+00:00",
                                        "fim": "2026-11-04T18:30:00+00:00",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "medico_id": 7,
                                        "medico_nome": "Inês Valente",
                                        "consentimento": true,
                                        "consentimento_gravacao": false,
                                        "gravacao_permitida": false,
                                        "sala_espera_em": "2026-11-04T17:56:10+00:00",
                                        "admitido_em": "2026-11-04T18:01:02+00:00",
                                        "identidade_metodo": "documento",
                                        "identidade_confirmada_em": "2026-11-04T18:02:30+00:00",
                                        "identidade_confirmada_por": "Inês Valente",
                                        "presentes": [
                                            {
                                                "nome": "Rui Almeida",
                                                "papel": "paciente",
                                                "relacao": "",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            },
                                            {
                                                "nome": "Sofia Almeida",
                                                "papel": "acompanhante",
                                                "relacao": "Cônjuge",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            }
                                        ],
                                        "video_configurado": true,
                                        "sala_url": null,
                                        "inicio_real": "2026-11-04T18:01:02+00:00",
                                        "fim_real": "2026-11-04T18:27:15+00:00",
                                        "relatorio_visivel": true,
                                        "relatorio": "Motivo: avaliação de queda de cabelo frontal com 3 anos de evolução.\nObservação por vídeo: recessão bitemporal, padrão compatível com Norwood III.\nAvaliação: candidato a avaliação presencial com tricoscopia.\nPlano e recomendações: marcar consulta presencial; manter tratamento tópico.\nPróximo contacto: consulta presencial em 2 semanas.\nA consulta decorreu por videoconsulta.",
                                        "relatorio_origem": "assistente",
                                        "relatorio_fechado_em": "2026-11-04T18:41:03+00:00",
                                        "comprovativo_ficheiro_id": 7790,
                                        "relatorio_ficheiro_id": 7789,
                                        "capturas": [
                                            {
                                                "ficheiro_id": 7781,
                                                "criado_em": "2026-11-04T18:12:40+00:00"
                                            }
                                        ],
                                        "assistente": true,
                                        "pode_editar": false,
                                        "passos": [
                                            {
                                                "chave": "consentimento",
                                                "feito": true
                                            },
                                            {
                                                "chave": "sala_espera",
                                                "feito": true
                                            },
                                            {
                                                "chave": "admitido",
                                                "feito": true
                                            },
                                            {
                                                "chave": "identidade",
                                                "feito": true
                                            },
                                            {
                                                "chave": "presentes",
                                                "feito": true
                                            },
                                            {
                                                "chave": "relatorio",
                                                "feito": true
                                            },
                                            {
                                                "chave": "fechada",
                                                "feito": true
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "A teleconsulta já está fechada."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Business rule (relatorio_em_falta)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "relatorio_em_falta": {
                                        "summary": "relatorio_em_falta",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "relatorio_em_falta",
                                                "mensagem": "Escreva o relatório antes de fechar.",
                                                "campos": {
                                                    "relatorio": "Escreva o relatório antes de fechar."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/ficheiros": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6TeleconsultaPartilhar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Share a file with the patient in the room",
                "description": "Image, PDF or document (up to 25 MB), validated by content, stored encrypted as a clinical file and shown in the patient’s room for download.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "id": 9,
                                            "ficheiro_id": 8811,
                                            "foto_id": null,
                                            "origem": "equipa",
                                            "origem_rotulo": "Partilhado pela equipa",
                                            "nome": "instrucoes-pre-operatorias.pdf",
                                            "tipo": "pdf",
                                            "tamanho": 182233,
                                            "criado_em": "2026-11-04T18:12:00+00:00",
                                            "retirado": false,
                                            "url": "https://clinica.pt/f/…"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/ficheiros/{linha}/retirar": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6TeleconsultaRetirar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "name": "linha",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Stop showing a file to the patient",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/gravacao": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6GravacaoTeleconsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Allow or prevent recording",
                "description": "Recording is off by default and can only be allowed with a valid recording consent (purpose «gravacao_video») — otherwise 422 «consentimento_em_falta». Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "permitir": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "permitir"
                                ]
                            },
                            "example": {
                                "permitir": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Teleconsulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 55,
                                        "marcacao_id": 8850,
                                        "estado": "em_curso",
                                        "estado_rotulo": "Em curso",
                                        "estado_tom": "marca",
                                        "inicio": "2026-11-04T18:00:00+00:00",
                                        "fim": "2026-11-04T18:30:00+00:00",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "medico_id": 7,
                                        "medico_nome": "Inês Valente",
                                        "consentimento": true,
                                        "consentimento_gravacao": true,
                                        "gravacao_permitida": true,
                                        "sala_espera_em": "2026-11-04T17:56:10+00:00",
                                        "admitido_em": "2026-11-04T18:01:02+00:00",
                                        "identidade_metodo": "documento",
                                        "identidade_confirmada_em": "2026-11-04T18:02:30+00:00",
                                        "identidade_confirmada_por": "Inês Valente",
                                        "presentes": [
                                            {
                                                "nome": "Rui Almeida",
                                                "papel": "paciente",
                                                "relacao": "",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            },
                                            {
                                                "nome": "Sofia Almeida",
                                                "papel": "acompanhante",
                                                "relacao": "Cônjuge",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            }
                                        ],
                                        "video_configurado": true,
                                        "sala_url": "https://video.clinica.pt/tc-1-55?papel=anfitriao&t=9f2c7a1e",
                                        "inicio_real": "2026-11-04T18:01:02+00:00",
                                        "fim_real": null,
                                        "relatorio_visivel": true,
                                        "relatorio": null,
                                        "relatorio_origem": null,
                                        "relatorio_fechado_em": null,
                                        "comprovativo_ficheiro_id": null,
                                        "relatorio_ficheiro_id": null,
                                        "capturas": [
                                            {
                                                "ficheiro_id": 7781,
                                                "criado_em": "2026-11-04T18:12:40+00:00"
                                            }
                                        ],
                                        "assistente": true,
                                        "pode_editar": true,
                                        "passos": [
                                            {
                                                "chave": "consentimento",
                                                "feito": true
                                            },
                                            {
                                                "chave": "sala_espera",
                                                "feito": true
                                            },
                                            {
                                                "chave": "admitido",
                                                "feito": true
                                            },
                                            {
                                                "chave": "identidade",
                                                "feito": true
                                            },
                                            {
                                                "chave": "presentes",
                                                "feito": true
                                            },
                                            {
                                                "chave": "relatorio",
                                                "feito": false
                                            },
                                            {
                                                "chave": "fechada",
                                                "feito": false
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Business rule (consentimento_em_falta)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "consentimento_em_falta": {
                                        "summary": "consentimento_em_falta",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "consentimento_em_falta",
                                                "mensagem": "Sem consentimento para gravar.",
                                                "campos": {
                                                    "gravacao": "Sem consentimento para gravar."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/identidade": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6IdentidadeTeleconsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Confirm the patient identity",
                "description": "Records the method, who confirmed and when (session start). Effects: audit.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "metodo": {
                                        "type": "string",
                                        "enum": [
                                            "documento",
                                            "conhecido",
                                            "dados_pessoais"
                                        ]
                                    }
                                },
                                "required": [
                                    "metodo"
                                ]
                            },
                            "example": {
                                "metodo": "documento"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Teleconsulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 55,
                                        "marcacao_id": 8850,
                                        "estado": "em_curso",
                                        "estado_rotulo": "Em curso",
                                        "estado_tom": "marca",
                                        "inicio": "2026-11-04T18:00:00+00:00",
                                        "fim": "2026-11-04T18:30:00+00:00",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "medico_id": 7,
                                        "medico_nome": "Inês Valente",
                                        "consentimento": true,
                                        "consentimento_gravacao": false,
                                        "gravacao_permitida": false,
                                        "sala_espera_em": "2026-11-04T17:56:10+00:00",
                                        "admitido_em": "2026-11-04T18:01:02+00:00",
                                        "identidade_metodo": "documento",
                                        "identidade_confirmada_em": "2026-11-04T18:02:30+00:00",
                                        "identidade_confirmada_por": "Inês Valente",
                                        "presentes": [
                                            {
                                                "nome": "Rui Almeida",
                                                "papel": "paciente",
                                                "relacao": "",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            },
                                            {
                                                "nome": "Sofia Almeida",
                                                "papel": "acompanhante",
                                                "relacao": "Cônjuge",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            }
                                        ],
                                        "video_configurado": true,
                                        "sala_url": "https://video.clinica.pt/tc-1-55?papel=anfitriao&t=9f2c7a1e",
                                        "inicio_real": "2026-11-04T18:01:02+00:00",
                                        "fim_real": null,
                                        "relatorio_visivel": true,
                                        "relatorio": null,
                                        "relatorio_origem": null,
                                        "relatorio_fechado_em": null,
                                        "comprovativo_ficheiro_id": null,
                                        "relatorio_ficheiro_id": null,
                                        "capturas": [
                                            {
                                                "ficheiro_id": 7781,
                                                "criado_em": "2026-11-04T18:12:40+00:00"
                                            }
                                        ],
                                        "assistente": true,
                                        "pode_editar": true,
                                        "passos": [
                                            {
                                                "chave": "consentimento",
                                                "feito": true
                                            },
                                            {
                                                "chave": "sala_espera",
                                                "feito": true
                                            },
                                            {
                                                "chave": "admitido",
                                                "feito": true
                                            },
                                            {
                                                "chave": "identidade",
                                                "feito": true
                                            },
                                            {
                                                "chave": "presentes",
                                                "feito": true
                                            },
                                            {
                                                "chave": "relatorio",
                                                "feito": false
                                            },
                                            {
                                                "chave": "fechada",
                                                "feito": false
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/presentes": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6PresentesTeleconsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Record who is present",
                "description": "Replaces the list (up to 12 people; rows without a name are ignored; unknown role becomes «outro»). Effects: audit (number of people only).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "presentes": {
                                        "type": "array",
                                        "maxItems": 12,
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "nome"
                                            ],
                                            "properties": {
                                                "nome": {
                                                    "type": "string",
                                                    "maxLength": 120
                                                },
                                                "papel": {
                                                    "type": "string",
                                                    "enum": [
                                                        "paciente",
                                                        "acompanhante",
                                                        "medico",
                                                        "interprete",
                                                        "outro"
                                                    ],
                                                    "default": "acompanhante"
                                                },
                                                "relacao": {
                                                    "type": "string",
                                                    "maxLength": 60
                                                }
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "presentes"
                                ]
                            },
                            "example": {
                                "presentes": [
                                    {
                                        "nome": "Rui Almeida",
                                        "papel": "paciente"
                                    },
                                    {
                                        "nome": "Sofia Almeida",
                                        "papel": "acompanhante",
                                        "relacao": "Cônjuge"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Teleconsulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 55,
                                        "marcacao_id": 8850,
                                        "estado": "em_curso",
                                        "estado_rotulo": "Em curso",
                                        "estado_tom": "marca",
                                        "inicio": "2026-11-04T18:00:00+00:00",
                                        "fim": "2026-11-04T18:30:00+00:00",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "medico_id": 7,
                                        "medico_nome": "Inês Valente",
                                        "consentimento": true,
                                        "consentimento_gravacao": false,
                                        "gravacao_permitida": false,
                                        "sala_espera_em": "2026-11-04T17:56:10+00:00",
                                        "admitido_em": "2026-11-04T18:01:02+00:00",
                                        "identidade_metodo": "documento",
                                        "identidade_confirmada_em": "2026-11-04T18:02:30+00:00",
                                        "identidade_confirmada_por": "Inês Valente",
                                        "presentes": [
                                            {
                                                "nome": "Rui Almeida",
                                                "papel": "paciente",
                                                "relacao": "",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            },
                                            {
                                                "nome": "Sofia Almeida",
                                                "papel": "acompanhante",
                                                "relacao": "Cônjuge",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            }
                                        ],
                                        "video_configurado": true,
                                        "sala_url": "https://video.clinica.pt/tc-1-55?papel=anfitriao&t=9f2c7a1e",
                                        "inicio_real": "2026-11-04T18:01:02+00:00",
                                        "fim_real": null,
                                        "relatorio_visivel": true,
                                        "relatorio": null,
                                        "relatorio_origem": null,
                                        "relatorio_fechado_em": null,
                                        "comprovativo_ficheiro_id": null,
                                        "relatorio_ficheiro_id": null,
                                        "capturas": [
                                            {
                                                "ficheiro_id": 7781,
                                                "criado_em": "2026-11-04T18:12:40+00:00"
                                            }
                                        ],
                                        "assistente": true,
                                        "pode_editar": true,
                                        "passos": [
                                            {
                                                "chave": "consentimento",
                                                "feito": true
                                            },
                                            {
                                                "chave": "sala_espera",
                                                "feito": true
                                            },
                                            {
                                                "chave": "admitido",
                                                "feito": true
                                            },
                                            {
                                                "chave": "identidade",
                                                "feito": true
                                            },
                                            {
                                                "chave": "presentes",
                                                "feito": true
                                            },
                                            {
                                                "chave": "relatorio",
                                                "feito": false
                                            },
                                            {
                                                "chave": "fechada",
                                                "feito": false
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/proposta": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6PropostaRelatorioTeleconsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Report draft by the Assistant",
                "description": "The Assistant («escriba» use, models chosen in Settings › AI models) drafts a structured report from the doctor notes (reason, reported history, video observation, assessment, plan, next contact), without inventing data. Patient data only goes to the local service, unless the specific option for this use is on. Nothing is saved: the doctor reviews, corrects and saves with PUT /teleconsultas/{id}/relatorio. Without the Assistant configured it returns 200 with ok:false and «erro». Requires «teleconsulta» edit and clinical record access. Limit: 20 requests per 10 minutes.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "notas": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 8000
                                    }
                                },
                                "required": [
                                    "notas"
                                ]
                            },
                            "example": {
                                "notas": "Queda frontal 3 anos. Recessão bitemporal. Norwood III. Sem doenças. Faz minoxidil. Marcar presencial com tricoscopia em 2 semanas."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6PropostaRelatorio"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "texto": "Motivo: avaliação de queda de cabelo frontal com 3 anos de evolução.\nObservação por vídeo: recessão bitemporal, padrão compatível com Norwood III.\nAvaliação: candidato a avaliação presencial com tricoscopia.\nPlano e recomendações: marcar consulta presencial; manter tratamento tópico.\nPróximo contacto: consulta presencial em 2 semanas.\nA consulta decorreu por videoconsulta.",
                                        "pedido_id": 5521,
                                        "erro": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/relatorio": {
            "put": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6RelatorioTeleconsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Save the report",
                "description": "Saves the report (up to 20,000 characters), encrypted with the clinical key; the person saving becomes the validator. When the text comes from an Assistant draft, send ia_pedido_id, ia_fornecedor and ia_modelo exactly as returned by POST /teleconsultas/{id}/proposta (origin «assistente»). Requires «teleconsulta» edit and clinical record access. Closed teleconsultation → 409. Effects: audit (field names only).",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "relatorio": {
                                        "type": "string",
                                        "maxLength": 20000
                                    },
                                    "ia_pedido_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Assistant request that produced the text."
                                    },
                                    "ia_fornecedor": {
                                        "type": "string",
                                        "maxLength": 20,
                                        "description": "AI service that answered (value returned by the draft)."
                                    },
                                    "ia_modelo": {
                                        "type": "string",
                                        "maxLength": 120,
                                        "description": "Model used (value returned by the draft)."
                                    }
                                },
                                "required": [
                                    "relatorio"
                                ]
                            },
                            "example": {
                                "relatorio": "Motivo: avaliação de queda de cabelo frontal com 3 anos de evolução.\nObservação por vídeo: recessão bitemporal, padrão compatível com Norwood III.\nAvaliação: candidato a avaliação presencial com tricoscopia.\nPlano e recomendações: marcar consulta presencial; manter tratamento tópico.\nPróximo contacto: consulta presencial em 2 semanas.\nA consulta decorreu por videoconsulta.",
                                "ia_pedido_id": 5521
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Teleconsulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 55,
                                        "marcacao_id": 8850,
                                        "estado": "em_curso",
                                        "estado_rotulo": "Em curso",
                                        "estado_tom": "marca",
                                        "inicio": "2026-11-04T18:00:00+00:00",
                                        "fim": "2026-11-04T18:30:00+00:00",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "medico_id": 7,
                                        "medico_nome": "Inês Valente",
                                        "consentimento": true,
                                        "consentimento_gravacao": false,
                                        "gravacao_permitida": false,
                                        "sala_espera_em": "2026-11-04T17:56:10+00:00",
                                        "admitido_em": "2026-11-04T18:01:02+00:00",
                                        "identidade_metodo": "documento",
                                        "identidade_confirmada_em": "2026-11-04T18:02:30+00:00",
                                        "identidade_confirmada_por": "Inês Valente",
                                        "presentes": [
                                            {
                                                "nome": "Rui Almeida",
                                                "papel": "paciente",
                                                "relacao": "",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            },
                                            {
                                                "nome": "Sofia Almeida",
                                                "papel": "acompanhante",
                                                "relacao": "Cônjuge",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            }
                                        ],
                                        "video_configurado": true,
                                        "sala_url": "https://video.clinica.pt/tc-1-55?papel=anfitriao&t=9f2c7a1e",
                                        "inicio_real": "2026-11-04T18:01:02+00:00",
                                        "fim_real": null,
                                        "relatorio_visivel": true,
                                        "relatorio": "Motivo: avaliação de queda de cabelo frontal com 3 anos de evolução.\nObservação por vídeo: recessão bitemporal, padrão compatível com Norwood III.\nAvaliação: candidato a avaliação presencial com tricoscopia.\nPlano e recomendações: marcar consulta presencial; manter tratamento tópico.\nPróximo contacto: consulta presencial em 2 semanas.\nA consulta decorreu por videoconsulta.",
                                        "relatorio_origem": "assistente",
                                        "relatorio_fechado_em": null,
                                        "comprovativo_ficheiro_id": null,
                                        "relatorio_ficheiro_id": null,
                                        "capturas": [
                                            {
                                                "ficheiro_id": 7781,
                                                "criado_em": "2026-11-04T18:12:40+00:00"
                                            }
                                        ],
                                        "assistente": true,
                                        "pode_editar": true,
                                        "passos": [
                                            {
                                                "chave": "consentimento",
                                                "feito": true
                                            },
                                            {
                                                "chave": "sala_espera",
                                                "feito": true
                                            },
                                            {
                                                "chave": "admitido",
                                                "feito": true
                                            },
                                            {
                                                "chave": "identidade",
                                                "feito": true
                                            },
                                            {
                                                "chave": "presentes",
                                                "feito": true
                                            },
                                            {
                                                "chave": "relatorio",
                                                "feito": false
                                            },
                                            {
                                                "chave": "fechada",
                                                "feito": false
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Não é possível neste estado."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/resumo": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6TeleconsultaResumo",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Draft the report from the transcript",
                "description": "Requires the «ia» consent. Nothing is saved: the doctor reviews and saves with PUT …/relatorio.",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "notas": {
                                        "type": "string",
                                        "maxLength": 8000
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "texto": {
                                                    "type": "string"
                                                },
                                                "fornecedor": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "modelo": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "pedido_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "erro": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/terminar": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6TerminarTeleconsulta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "End the call",
                "description": "Sets «terminada» and records the end time; the report can be written afterwards. Only from scheduled, waiting room or in progress (409 «estado_invalido»). Effects: audit.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M6Teleconsulta"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 55,
                                        "marcacao_id": 8850,
                                        "estado": "terminada",
                                        "estado_rotulo": "Terminada",
                                        "estado_tom": "info",
                                        "inicio": "2026-11-04T18:00:00+00:00",
                                        "fim": "2026-11-04T18:30:00+00:00",
                                        "paciente_id": 1204,
                                        "paciente_nome": "Rui Almeida",
                                        "medico_id": 7,
                                        "medico_nome": "Inês Valente",
                                        "consentimento": true,
                                        "consentimento_gravacao": false,
                                        "gravacao_permitida": false,
                                        "sala_espera_em": "2026-11-04T17:56:10+00:00",
                                        "admitido_em": "2026-11-04T18:01:02+00:00",
                                        "identidade_metodo": "documento",
                                        "identidade_confirmada_em": "2026-11-04T18:02:30+00:00",
                                        "identidade_confirmada_por": "Inês Valente",
                                        "presentes": [
                                            {
                                                "nome": "Rui Almeida",
                                                "papel": "paciente",
                                                "relacao": "",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            },
                                            {
                                                "nome": "Sofia Almeida",
                                                "papel": "acompanhante",
                                                "relacao": "Cônjuge",
                                                "registado_em": "2026-11-04T18:03:00+00:00"
                                            }
                                        ],
                                        "video_configurado": true,
                                        "sala_url": "https://video.clinica.pt/tc-1-55?papel=anfitriao&t=9f2c7a1e",
                                        "inicio_real": "2026-11-04T18:01:02+00:00",
                                        "fim_real": "2026-11-04T18:27:15+00:00",
                                        "relatorio_visivel": true,
                                        "relatorio": null,
                                        "relatorio_origem": null,
                                        "relatorio_fechado_em": null,
                                        "comprovativo_ficheiro_id": null,
                                        "relatorio_ficheiro_id": null,
                                        "capturas": [
                                            {
                                                "ficheiro_id": 7781,
                                                "criado_em": "2026-11-04T18:12:40+00:00"
                                            }
                                        ],
                                        "assistente": true,
                                        "pode_editar": true,
                                        "passos": [
                                            {
                                                "chave": "consentimento",
                                                "feito": true
                                            },
                                            {
                                                "chave": "sala_espera",
                                                "feito": true
                                            },
                                            {
                                                "chave": "admitido",
                                                "feito": true
                                            },
                                            {
                                                "chave": "identidade",
                                                "feito": true
                                            },
                                            {
                                                "chave": "presentes",
                                                "feito": true
                                            },
                                            {
                                                "chave": "relatorio",
                                                "feito": false
                                            },
                                            {
                                                "chave": "fechada",
                                                "feito": false
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Business rule (estado_invalido)",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/M6RespostaErro"
                                },
                                "examples": {
                                    "estado_invalido": {
                                        "summary": "estado_invalido",
                                        "value": {
                                            "ok": false,
                                            "erro": {
                                                "codigo": "estado_invalido",
                                                "mensagem": "Não é possível neste estado."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/transcricao": {
            "get": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6TeleconsultaTranscricao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Session transcript text",
                "description": "Audited read; requires the patient clinical record.",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "texto": {
                                                    "type": "string"
                                                },
                                                "partes": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            },
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6TeleconsultaTranscrever",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Transcribe a part of the session audio",
                "description": "Only with valid «gravacao_video» and «ia» consents and recording allowed. Part up to 25 MB and 15 minutes. Transcribed by the «teleconsulta_resumo» AI use (local service first); text appended to the encrypted transcript; audio never stored.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ficheiro",
                                    "parte"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "parte": {
                                        "type": "integer"
                                    },
                                    "lingua": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "pode_transcrever": true,
                                        "pode_resumir": true,
                                        "tem_transcricao": true,
                                        "partes": 4,
                                        "segundos": 120,
                                        "repetida": false,
                                        "caracteres": 412
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflito"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/teleconsultas/{id}/transcricao/descartar": {
            "post": {
                "tags": [
                    "Teleconsulta"
                ],
                "operationId": "m6TeleconsultaDescartar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Teleconsultation identifier"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-nivel": "editar",
                "summary": "Discard the transcript",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/tricoscopia": {
            "post": {
                "tags": [
                    "Tricoscopia"
                ],
                "operationId": "criarCampoTricoscopia",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Save a field",
                "description": "Calculated values are always recalculated on the server. ponto: {x, y} on the diagram (0–1) or {x, y, z} on the 3D model.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "subzona": {
                                        "type": "string"
                                    },
                                    "captura_id": {
                                        "type": "integer"
                                    },
                                    "marco_id": {
                                        "type": "integer"
                                    },
                                    "aparelho": {
                                        "type": "string"
                                    },
                                    "ampliacao": {
                                        "type": "number"
                                    },
                                    "area_campo_mm2": {
                                        "type": "number"
                                    },
                                    "uf_1": {
                                        "type": "integer"
                                    },
                                    "uf_2": {
                                        "type": "integer"
                                    },
                                    "uf_3": {
                                        "type": "integer"
                                    },
                                    "uf_4": {
                                        "type": "integer"
                                    },
                                    "calibre_mm": {
                                        "type": "number"
                                    },
                                    "calibre_amostra": {
                                        "type": "integer"
                                    },
                                    "ponto": {
                                        "type": "object"
                                    },
                                    "notas": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "paciente_id",
                                    "subzona",
                                    "area_campo_mm2"
                                ]
                            },
                            "example": {
                                "paciente_id": 1204,
                                "subzona": "occipital",
                                "aparelho": "Dermatoscópio A",
                                "ampliacao": 20,
                                "area_campo_mm2": 100,
                                "uf_1": 18,
                                "uf_2": 38,
                                "uf_3": 17,
                                "uf_4": 2,
                                "ponto": {
                                    "x": 0.5,
                                    "y": 0.91
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "campo": {
                                                    "$ref": "#/components/schemas/CampoTricoscopia"
                                                },
                                                "calculo": {
                                                    "$ref": "#/components/schemas/CalculoCampo"
                                                },
                                                "medias": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/tricoscopia/analisar": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "analisarTricoscopia",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Count on the trichoscope image (proposal)",
                "description": "FU by type, hairs and diameters proposed by the vision AI; the server converts diameters into calibre and classes and computes densities with the same calculation as manual counts. Pending until decided. Requires «ia» consent.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "paciente_id",
                                    "area_campo_mm2",
                                    "subzona"
                                ],
                                "properties": {
                                    "ficheiro": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "ficheiro_id": {
                                        "type": "integer"
                                    },
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "area_campo_mm2": {
                                        "type": "number",
                                        "x-unidade": "mm²"
                                    },
                                    "subzona": {
                                        "type": "string"
                                    },
                                    "aparelho": {
                                        "type": "string"
                                    },
                                    "ampliacao": {
                                        "type": "number"
                                    },
                                    "captura_id": {
                                        "type": "integer"
                                    },
                                    "tricoscopia_id": {
                                        "type": "integer"
                                    },
                                    "ponto": {
                                        "type": "string",
                                        "description": "JSON {x, y[, z]}"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/AnaliseTricoscopia"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/tricoscopia/analises": {
            "get": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "listarAnalisesTricoscopia",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "ver",
                "summary": "Patient count proposals and agreement",
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Patient"
                    },
                    {
                        "name": "estado",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pendente",
                                "aceite",
                                "corrigida",
                                "recusada"
                            ]
                        },
                        "description": "Status"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/AnaliseTricoscopia"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "desempenho": {
                                                    "type": "object"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/tricoscopia/analises/{id}/decidir": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "decidirAnaliseTricoscopia",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Accept, correct or reject the proposal",
                "description": "«aceite» saves the field with the proposed values; «corrigida» with the sent values; «recusada» requires a reason.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "aceite",
                                            "corrigida",
                                            "recusada"
                                        ]
                                    },
                                    "valores": {
                                        "type": "object"
                                    },
                                    "motivo": {
                                        "type": "string",
                                        "maxLength": 400
                                    },
                                    "campo": {
                                        "type": "object"
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "corrigida",
                                "valores": {
                                    "uf_1": 17,
                                    "uf_2": 39,
                                    "uf_3": 16,
                                    "uf_4": 2
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "analise": {
                                                    "$ref": "#/components/schemas/AnaliseTricoscopia"
                                                },
                                                "campo": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/tricoscopia/calcular": {
            "post": {
                "tags": [
                    "Tricoscopia"
                ],
                "operationId": "calcularCampoTricoscopia",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "ver",
                "summary": "Calculate a field (live, without saving)",
                "description": "FU/cm² = FU ÷ (area mm² ÷ 100); hairs/cm²; hairs/FU; FU composition; thickness classes by counts; coverage value = calibre × hairs/cm²; warnings (calibre from fewer than 25 hairs, percentages not adding to 100).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "area_campo_mm2": {
                                        "type": "number",
                                        "x-unidade": "mm²"
                                    },
                                    "uf_1": {
                                        "type": "integer"
                                    },
                                    "uf_2": {
                                        "type": "integer"
                                    },
                                    "uf_3": {
                                        "type": "integer"
                                    },
                                    "uf_4": {
                                        "type": "integer"
                                    },
                                    "cabelos_total": {
                                        "type": "integer"
                                    },
                                    "calibre_mm": {
                                        "type": "number",
                                        "x-unidade": "mm"
                                    },
                                    "calibre_amostra": {
                                        "type": "integer"
                                    },
                                    "n_vellus": {
                                        "type": "integer"
                                    },
                                    "n_intermedios": {
                                        "type": "integer"
                                    },
                                    "n_terminais": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "area_campo_mm2"
                                ]
                            },
                            "example": {
                                "area_campo_mm2": 100,
                                "uf_1": 18,
                                "uf_2": 38,
                                "uf_3": 17,
                                "uf_4": 2,
                                "calibre_mm": 0.065,
                                "calibre_amostra": 30
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/CalculoCampo"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "densidade_uf_cm2": {
                                            "valor": 75,
                                            "unidade": "UF/cm²"
                                        },
                                        "densidade_cabelos_cm2": {
                                            "valor": 153,
                                            "unidade": "cabelos/cm²"
                                        },
                                        "cabelos_por_uf": {
                                            "valor": 2.04,
                                            "unidade": "cabelos/UF"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/tricoscopia/medicoes": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "criarMedicaoCapilar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Record a trichogram or hair mass index",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tipo": {
                                        "type": "string"
                                    },
                                    "paciente_id": {
                                        "type": "integer"
                                    },
                                    "subzona": {
                                        "type": "string"
                                    },
                                    "ponto": {
                                        "type": "object"
                                    },
                                    "data": {
                                        "type": "string"
                                    },
                                    "aparado_em": {
                                        "type": "string"
                                    },
                                    "anagenio": {
                                        "type": "integer"
                                    },
                                    "telogenio": {
                                        "type": "integer"
                                    },
                                    "indice_massa": {
                                        "type": "number"
                                    },
                                    "aparelho": {
                                        "type": "string"
                                    },
                                    "area_campo_mm2": {
                                        "type": "number"
                                    },
                                    "captura_id": {
                                        "type": "integer"
                                    },
                                    "marco_id": {
                                        "type": "integer"
                                    },
                                    "ficheiro_id": {
                                        "type": "integer"
                                    },
                                    "ficheiro_aparo_id": {
                                        "type": "integer"
                                    },
                                    "notas": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "tipo",
                                    "paciente_id",
                                    "subzona"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MedicaoCapilar"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/tricoscopia/medicoes/calcular": {
            "post": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "calcularMedicaoCapilar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "ver",
                "summary": "Calculate a measurement (without saving)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tipo": {
                                        "type": "string",
                                        "enum": [
                                            "tricograma",
                                            "massa_capilar"
                                        ]
                                    },
                                    "anagenio": {
                                        "type": "integer"
                                    },
                                    "telogenio": {
                                        "type": "integer"
                                    },
                                    "aparado_em": {
                                        "type": "string"
                                    },
                                    "data": {
                                        "type": "string"
                                    },
                                    "indice_massa": {
                                        "type": "number"
                                    }
                                },
                                "required": [
                                    "tipo"
                                ]
                            },
                            "example": {
                                "tipo": "tricograma",
                                "anagenio": 42,
                                "telogenio": 8,
                                "aparado_em": "2026-10-27 10:00:00",
                                "data": "2026-10-29 10:30:00"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/tricoscopia/medicoes/{id}": {
            "put": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "alterarMedicaoCapilar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Update a measurement",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tipo": {
                                        "type": "string"
                                    },
                                    "subzona": {
                                        "type": "string"
                                    },
                                    "data": {
                                        "type": "string"
                                    },
                                    "aparado_em": {
                                        "type": "string"
                                    },
                                    "anagenio": {
                                        "type": "integer"
                                    },
                                    "telogenio": {
                                        "type": "integer"
                                    },
                                    "indice_massa": {
                                        "type": "number"
                                    },
                                    "notas": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/MedicaoCapilar"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "apagarMedicaoCapilar",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Delete a measurement",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/tricoscopia/pacientes/{paciente_id}": {
            "get": {
                "tags": [
                    "Tricoscopia"
                ],
                "operationId": "tricoscopiaPaciente",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "ver",
                "summary": "Fields, per-subzone averages and calibrations",
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "captura_id",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Capture"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/tricoscopia/pacientes/{paciente_id}/seguimento": {
            "get": {
                "tags": [
                    "Análise e plano"
                ],
                "operationId": "seguimentoTricoscopia",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:ver"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "name": "paciente_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "ver",
                "summary": "Trichogram, hair mass and same-point series",
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "medicoes": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/MedicaoCapilar"
                                                    }
                                                },
                                                "series": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "tolerancia": {
                                                    "type": "number"
                                                },
                                                "subzonas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "tipos": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "horas_tricograma": {
                                                    "$ref": "#/components/schemas/ValorComUnidade"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    }
                }
            }
        },
        "/tricoscopia/usar-no-plano": {
            "post": {
                "tags": [
                    "Tricoscopia"
                ],
                "operationId": "usarTricoscopiaNoPlano",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.plano:editar"
                        ]
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-nivel": "editar",
                "summary": "Use the averages in the plan",
                "description": "Fills the draft plan donors (density, hairs/FU, calibre, deviation, samples) and recalculates.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "plano_id": {
                                        "type": "integer"
                                    },
                                    "captura_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "plano_id"
                                ]
                            },
                            "example": {
                                "plano_id": 318
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "plano_id": {
                                                    "type": "integer"
                                                },
                                                "subzonas": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "resultado": {
                                                    "$ref": "#/components/schemas/ResultadoMotor"
                                                },
                                                "mensagem": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/tricoscopia/{id}": {
            "put": {
                "tags": [
                    "Tricoscopia"
                ],
                "operationId": "alterarCampoTricoscopia",
                "security": [
                    {
                        "utilizador": []
                    },
                    {
                        "integracao": [
                            "ficha.captura:editar"
                        ]
                    }
                ],
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-nivel": "editar",
                "summary": "Update a field",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "subzona": {
                                        "type": "string"
                                    },
                                    "uf_1": {
                                        "type": "integer"
                                    },
                                    "uf_2": {
                                        "type": "integer"
                                    },
                                    "uf_3": {
                                        "type": "integer"
                                    },
                                    "uf_4": {
                                        "type": "integer"
                                    },
                                    "calibre_mm": {
                                        "type": "number"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "campo": {
                                                    "$ref": "#/components/schemas/CampoTricoscopia"
                                                },
                                                "calculo": {
                                                    "$ref": "#/components/schemas/CalculoCampo"
                                                },
                                                "medias": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    }
                }
            }
        },
        "/validacoes": {
            "get": {
                "tags": [
                    "Validação médica"
                ],
                "operationId": "m1FilaValidacao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "Validation queue",
                "description": "Items awaiting a decision, up to 200, urgent ones first (triage, alarms, high-severity alerts) then the oldest: pending AI proposals (summaries excluded), responses awaiting validation, pre-assessments (lead-only ones just for callers who edit the clinical record), reported alerts awaiting validation and consultations awaiting signature (doctors see their own; with «all» scope, every one). Only patients in clinical scope; only the patient name and number. meta.contadores gives the count per type. Unknown type → every type. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "tipo",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "proposta",
                                "resposta",
                                "pre_avaliacao",
                                "alerta",
                                "consulta"
                            ]
                        },
                        "description": "Filter by type"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/M1ItemValidacao"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "contadores": {
                                                    "$ref": "#/components/schemas/M1ContadoresValidacao"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "tipo": "resposta",
                                            "tipo_rotulo": "Resposta",
                                            "id": 5120,
                                            "chave": "resposta:5120",
                                            "paciente_id": 1204,
                                            "paciente_nome": "Rui Almeida",
                                            "paciente_numero": "P-2026-0311",
                                            "lead_id": null,
                                            "titulo": "Questionário prévio — FUE",
                                            "subtitulo": "Paciente · 7 pontos",
                                            "data": "2026-10-27T18:02:00+00:00",
                                            "urgente": true,
                                            "extra": {
                                                "fotos": 0,
                                                "devolvida": false
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/validacoes/alertas/{id}/decisao": {
            "post": {
                "tags": [
                    "Validação médica"
                ],
                "operationId": "m1DecidirAlerta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Alert identifier (pacientes_alertas)"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Accept or refuse a reported alert",
                "description": "«aceite» validates the alert (stays active and counts in eligibility and the record header); «recusado» deactivates it. Records who decided and when. Effects: «aprovar» audit. Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "aceite",
                                            "recusado"
                                        ]
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "aceite"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "decisao": {
                                                    "type": "string",
                                                    "enum": [
                                                        "aceite",
                                                        "recusado"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 55,
                                        "decisao": "aceite"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/validacoes/desempenho": {
            "get": {
                "tags": [
                    "Validação médica"
                ],
                "operationId": "m1DesempenhoIa",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "AI performance review",
                "description": "Over a period (defaults to the last 90 days): agreement (accepted ÷ decided, in %), corrections and refusals, per proposal type and per model, and the weekly agreement trend. Only proposals for patients in the caller clinical scope. Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "de",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "From (YYYY-MM-DD)"
                    },
                    {
                        "name": "ate",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "To (YYYY-MM-DD; defaults to today)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1DesempenhoIa"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "de": "2026-07-31",
                                        "ate": "2026-10-29",
                                        "totais": {
                                            "pendente": 4,
                                            "aceite": 61,
                                            "corrigida": 12,
                                            "recusada": 7,
                                            "decididas": 80,
                                            "concordancia": 76.3
                                        },
                                        "por_tipo": [
                                            {
                                                "chave": "escriba",
                                                "rotulo": "Escriba",
                                                "pendente": 3,
                                                "aceite": 48,
                                                "corrigida": 9,
                                                "recusada": 4,
                                                "decididas": 61,
                                                "total": 64,
                                                "concordancia": 78.7
                                            }
                                        ],
                                        "serie": [
                                            {
                                                "x": "2026-43",
                                                "y": 80,
                                                "serie": "Concordância"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/validacoes/respostas/{id}/decisao": {
            "post": {
                "tags": [
                    "Validação médica"
                ],
                "operationId": "m1DecidirResposta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Response identifier (formularios_respostas)"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Validate or reject a response",
                "description": "Only «por_validar» responses (otherwise 422). «validado» brings the response into the record and validates the alerts reported in it; «rejeitado» deactivates those alerts. Closes the linked medical review task. Effects: timeline (with patient), «aprovar» audit with the reason (up to 400 characters). Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "decisao": {
                                        "type": "string",
                                        "enum": [
                                            "validado",
                                            "rejeitado"
                                        ]
                                    },
                                    "motivo": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 400
                                    }
                                },
                                "required": [
                                    "decisao"
                                ]
                            },
                            "example": {
                                "decisao": "validado"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "estado": {
                                                    "type": "string",
                                                    "enum": [
                                                        "validado",
                                                        "rejeitado"
                                                    ]
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 5120,
                                        "estado": "validado"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/validacoes/respostas/{id}/devolver": {
            "post": {
                "tags": [
                    "Validação médica"
                ],
                "operationId": "m1DevolverResposta",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Response identifier (formularios_respostas)"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "editar",
                "summary": "Return to the patient asking for information",
                "description": "Only «por_validar» responses not saved by the team (otherwise 422). The response goes back to «pendente» with a new link (form settings deadline, 14 days by default); the request (1 to 2000 characters, encrypted) is shown at the top of the form, never in the message. Channel email, sms or whatsapp sends the service message without clinical content; «ligacao» only returns the link; any other value → email. expira_em comes in ISO 8601. Effects: «enviar» audit. Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "pedido": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2000
                                    },
                                    "canal": {
                                        "type": "string",
                                        "enum": [
                                            "email",
                                            "sms",
                                            "whatsapp",
                                            "ligacao"
                                        ],
                                        "default": "email"
                                    }
                                },
                                "required": [
                                    "pedido"
                                ]
                            },
                            "example": {
                                "pedido": "Indique a dose e há quanto tempo toma o anticoagulante.",
                                "canal": "email"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1PedidoFormulario"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "id": 5120,
                                        "ligacao": "https://clinica.exemplo.pt/formulario/q3V9k1sXw7bE2mN4tR8yU0pL6aZ5cH1dF9gJ3kM2nB4",
                                        "expira_em": "2026-11-12T09:40:00+00:00",
                                        "envio": {
                                            "ok": true,
                                            "estado": "enviada",
                                            "motivo": null,
                                            "mensagem_id": 66102
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "422": {
                        "$ref": "#/components/responses/ErroValidacao"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/validacoes/{tipo}/{id}": {
            "get": {
                "tags": [
                    "Validação médica"
                ],
                "operationId": "m1DetalheValidacao",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-nivel": "ver",
                "summary": "Queue item detail",
                "description": "With the clinical content: the proposal (with pode_decidir), the readable response (items, score and band, alarm, photos, linked triage proposals), the alert or the consultation (with permissions). Type outside the list → 404. Lead-only items require «edit» on ficha.clinica. Read is audited («ver» on the item table). Patient out of scope: 403 «sem_permissao» with erro.paciente_id (the app offers emergency access). Limit (default): 120 requests per minute per access token (X-RateLimit-Limit/-Remaining/-Reset headers; beyond that 429 with Retry-After).",
                "parameters": [
                    {
                        "name": "tipo",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "proposta",
                                "resposta",
                                "pre_avaliacao",
                                "alerta",
                                "consulta"
                            ]
                        },
                        "example": "resposta"
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Item identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "$ref": "#/components/schemas/M1DetalheValidacao"
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        },
        "/webhooks/eventos": {
            "get": {
                "tags": [
                    "Integrações"
                ],
                "operationId": "listarEventosDeWebhook",
                "summary": "Webhook event catalogue",
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "ver",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "evento": {
                                                        "type": "string"
                                                    },
                                                    "descricao": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": [
                                        {
                                            "evento": "lead.criado",
                                            "descricao": "Lead criado"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    }
                }
            }
        },
        "/webhooks/{id}/testar": {
            "post": {
                "tags": [
                    "Integrações"
                ],
                "operationId": "testarWebhook",
                "summary": "Send a test delivery",
                "description": "Sends the signed «webhook.teste» event now and returns the result (HTTP status, duration, error). Does not count towards the endpoint's consecutive failures.",
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-nivel": "editar",
                "security": [
                    {
                        "utilizador": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 12,
                        "description": "Identifier"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "headers": {
                            "X-Request-Id": {
                                "$ref": "#/components/headers/XRequestId"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ok",
                                        "dados"
                                    ],
                                    "properties": {
                                        "ok": {
                                            "const": true
                                        },
                                        "dados": {
                                            "type": "object",
                                            "properties": {
                                                "ok": {
                                                    "type": "boolean"
                                                },
                                                "estado": {
                                                    "type": "string"
                                                },
                                                "codigo_http": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "duracao_ms": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "erro": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "entrega_id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "example": {
                                    "ok": true,
                                    "dados": {
                                        "ok": true,
                                        "estado": "entregue",
                                        "codigo_http": 204,
                                        "duracao_ms": 182,
                                        "erro": null,
                                        "entrega_id": 1843
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/NaoAutenticado"
                    },
                    "403": {
                        "$ref": "#/components/responses/SemPermissao"
                    },
                    "404": {
                        "$ref": "#/components/responses/NaoEncontrado"
                    },
                    "429": {
                        "$ref": "#/components/responses/LimiteExcedido"
                    }
                }
            }
        }
    },
    "webhooks": {
        "marcacao.criada": {
            "post": {
                "summary": "Appointment created",
                "description": "An appointment was created (by the team or the API, the portal, the website, the agent, from the waiting list or as the result of a reschedule — in that case, the event belongs to the new appointment). Surgical blocks booked on the surgery map do not fire this event: the surgery cycle ends in cirurgia.fechada.",
                "tags": [
                    "Agenda"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "marcacao.criada"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "tipo_chave",
                                            "inicio",
                                            "fim",
                                            "estado",
                                            "origem"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "lead_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "tipo_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "tipo_chave": {
                                                "type": "string"
                                            },
                                            "profissional_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "inicio": {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            "fim": {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            "estado": {
                                                "type": "string",
                                                "enum": [
                                                    "pedido",
                                                    "marcada",
                                                    "confirmada",
                                                    "em_curso",
                                                    "concluida",
                                                    "faltou",
                                                    "cancelada",
                                                    "remarcada"
                                                ]
                                            },
                                            "origem": {
                                                "type": "string",
                                                "enum": [
                                                    "equipa",
                                                    "portal",
                                                    "site",
                                                    "agente",
                                                    "telefone"
                                                ]
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "marcacao.criada",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 418,
                                    "paciente_id": 12,
                                    "lead_id": null,
                                    "tipo_id": 1,
                                    "tipo_chave": "primeira_consulta",
                                    "profissional_id": 4,
                                    "inicio": "2026-11-03T10:00:00+00:00",
                                    "fim": "2026-11-03T10:45:00+00:00",
                                    "estado": "marcada",
                                    "origem": "portal"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "marcacao.confirmada": {
            "post": {
                "summary": "Appointment confirmed",
                "description": "The appointment became confirmed: by the team (for example, after a phone call), by the patient on the public appointment page or in the portal, or by replying to the reminder.",
                "tags": [
                    "Agenda"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "marcacao.confirmada"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "tipo_chave",
                                            "inicio",
                                            "fim",
                                            "estado",
                                            "origem"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "lead_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "tipo_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "tipo_chave": {
                                                "type": "string"
                                            },
                                            "profissional_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "inicio": {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            "fim": {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            "estado": {
                                                "type": "string",
                                                "enum": [
                                                    "pedido",
                                                    "marcada",
                                                    "confirmada",
                                                    "em_curso",
                                                    "concluida",
                                                    "faltou",
                                                    "cancelada",
                                                    "remarcada"
                                                ]
                                            },
                                            "origem": {
                                                "type": "string",
                                                "enum": [
                                                    "equipa",
                                                    "portal",
                                                    "site",
                                                    "agente",
                                                    "telefone"
                                                ]
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "marcacao.confirmada",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 418,
                                    "paciente_id": 12,
                                    "lead_id": null,
                                    "tipo_id": 1,
                                    "tipo_chave": "primeira_consulta",
                                    "profissional_id": 4,
                                    "inicio": "2026-11-03T10:00:00+00:00",
                                    "fim": "2026-11-03T10:45:00+00:00",
                                    "estado": "confirmada",
                                    "origem": "portal"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "marcacao.cancelada": {
            "post": {
                "summary": "Appointment cancelled",
                "description": "The appointment was cancelled by the team, by the patient (public page or portal) or by the system (automatic release of unconfirmed slots, when enabled in Settings). The cancellation reason is not sent.",
                "tags": [
                    "Agenda"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "marcacao.cancelada"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "tipo_chave",
                                            "inicio",
                                            "fim",
                                            "estado",
                                            "origem"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "lead_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "tipo_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "tipo_chave": {
                                                "type": "string"
                                            },
                                            "profissional_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "inicio": {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            "fim": {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            "estado": {
                                                "type": "string",
                                                "enum": [
                                                    "pedido",
                                                    "marcada",
                                                    "confirmada",
                                                    "em_curso",
                                                    "concluida",
                                                    "faltou",
                                                    "cancelada",
                                                    "remarcada"
                                                ]
                                            },
                                            "origem": {
                                                "type": "string",
                                                "enum": [
                                                    "equipa",
                                                    "portal",
                                                    "site",
                                                    "agente",
                                                    "telefone"
                                                ]
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "marcacao.cancelada",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 418,
                                    "paciente_id": 12,
                                    "lead_id": null,
                                    "tipo_id": 1,
                                    "tipo_chave": "primeira_consulta",
                                    "profissional_id": 4,
                                    "inicio": "2026-11-03T10:00:00+00:00",
                                    "fim": "2026-11-03T10:45:00+00:00",
                                    "estado": "cancelada",
                                    "origem": "portal"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "cirurgia.fechada": {
            "post": {
                "summary": "Surgery closed",
                "description": "The surgical session was closed on the surgical panel (definitive closing, with double confirmation). It carries only identifiers and times; graft counts, technique and transection are read from GET /bloco/cirurgias/{id} with the permissions of the caller.",
                "tags": [
                    "Bloco operatório"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "cirurgia.fechada"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "numero",
                                            "paciente_id",
                                            "fim_real"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "numero": {
                                                "type": "string"
                                            },
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "episodio_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "inicio_real": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            },
                                            "fim_real": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "cirurgia.fechada",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 37,
                                    "numero": "CIR-2026-0037",
                                    "paciente_id": 12,
                                    "episodio_id": 9,
                                    "inicio_real": "2026-11-10T08:12:00+00:00",
                                    "fim_real": "2026-11-10T15:47:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "paciente.criado": {
            "post": {
                "summary": "Patient created",
                "description": "A new patient entered the clinic single record (team form, lead conversion, pre-assessment, agent or file import — one event per imported patient). When creation finds a strong duplicate and reuses the existing patient, the event is not fired.",
                "tags": [
                    "Ficha do paciente"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "paciente.criado"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "numero",
                                            "criado_em"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "numero": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "Clinic file number"
                                            },
                                            "origem": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "enum": [
                                                    "site",
                                                    "pre_avaliacao",
                                                    "recomendacao",
                                                    "telefone",
                                                    "presencial",
                                                    "redes",
                                                    "agente",
                                                    "importacao",
                                                    "outro",
                                                    null
                                                ]
                                            },
                                            "lead_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "criado_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "paciente.criado",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 1204,
                                    "numero": "P-2026-01204",
                                    "origem": "pre_avaliacao",
                                    "lead_id": 3381,
                                    "criado_em": "2026-10-28T10:12:44+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "paciente.fundido": {
            "post": {
                "summary": "Patients merged",
                "description": "Two records of the same person were merged. Every row of the removed patient (episodes, consultations, forms, appointments, documents, payments…) moved to the kept patient; the removed one was archived and soft-deleted. Update the references to «removido_id» in your system.",
                "tags": [
                    "Ficha do paciente"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "paciente.fundido"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "manter_id",
                                            "removido_id",
                                            "fundido_em"
                                        ],
                                        "properties": {
                                            "manter_id": {
                                                "type": "integer"
                                            },
                                            "removido_id": {
                                                "type": "integer"
                                            },
                                            "fundido_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "paciente.fundido",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "manter_id": 1204,
                                    "removido_id": 1388,
                                    "fundido_em": "2026-10-28T15:30:02+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "episodio.aberto": {
            "post": {
                "summary": "Treatment episode opened",
                "description": "A treatment episode was opened for a patient (for example when creating the first consultation without an active episode, converting a lead or from the episode list). The journey stage starts at 2 (pre-assessment) when it comes from a lead and at 3 (consultation) otherwise.",
                "tags": [
                    "Ficha do paciente"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "episodio.aberto"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "paciente_id",
                                            "estado",
                                            "etapa_jornada"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "numero": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "estado": {
                                                "type": "string",
                                                "enum": [
                                                    "avaliacao",
                                                    "plano",
                                                    "proposta",
                                                    "agendado",
                                                    "pre_operatorio",
                                                    "cirurgia",
                                                    "pos_operatorio",
                                                    "acompanhamento",
                                                    "concluido",
                                                    "cancelado"
                                                ]
                                            },
                                            "etapa_jornada": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "episodio.aberto",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 77,
                                    "numero": "E-2026-0077",
                                    "paciente_id": 1204,
                                    "estado": "avaliacao",
                                    "etapa_jornada": 3
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "episodio.estado_alterado": {
            "post": {
                "summary": "Episode status changed",
                "description": "The episode changed status and, with it, its journey stage (avaliacao 3 · plano 4 · proposta 5 · agendado and pre_operatorio 6 · cirurgia 7 · pos_operatorio 8 · acompanhamento and concluido 9; «cancelado» keeps the stage). It happens, for example, when the doctor validates feasibility in the consultation («feasible» → plan; «not feasible» → cancelled), through the «Change status» action or in other modules' flows (accepted proposal, closed surgery). Each change opens the configured automatic tasks and notifies the next department.",
                "tags": [
                    "Ficha do paciente"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "episodio.estado_alterado"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "paciente_id",
                                            "anterior",
                                            "estado",
                                            "etapa_jornada",
                                            "alterado_em"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "numero": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "anterior": {
                                                "type": "string"
                                            },
                                            "estado": {
                                                "type": "string",
                                                "enum": [
                                                    "avaliacao",
                                                    "plano",
                                                    "proposta",
                                                    "agendado",
                                                    "pre_operatorio",
                                                    "cirurgia",
                                                    "pos_operatorio",
                                                    "acompanhamento",
                                                    "concluido",
                                                    "cancelado"
                                                ]
                                            },
                                            "etapa_jornada": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9
                                            },
                                            "alterado_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "episodio.estado_alterado",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 77,
                                    "numero": "E-2026-0077",
                                    "paciente_id": 1204,
                                    "anterior": "avaliacao",
                                    "estado": "plano",
                                    "etapa_jornada": 4,
                                    "alterado_em": "2026-10-28T11:05:19+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "consulta.assinada": {
            "post": {
                "summary": "Consultation signed",
                "description": "A doctor signed the consultation. From now on the record is closed (sealed with the SHA-256 fingerprint of its content) and only accepts addenda. The event carries no clinical content: to read it, use GET /consultas/{id} with clinical permissions.",
                "tags": [
                    "Consultas"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "consulta.assinada"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "paciente_id",
                                            "tipo",
                                            "assinada_em"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "episodio_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "primeira",
                                                    "avaliacao",
                                                    "controlo",
                                                    "teleconsulta",
                                                    "pre_operatoria"
                                                ]
                                            },
                                            "assinada_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "consulta.assinada",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 940,
                                    "paciente_id": 1204,
                                    "episodio_id": 77,
                                    "tipo": "primeira",
                                    "assinada_em": "2026-10-28T11:02:40+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "formulario.respondido": {
            "post": {
                "summary": "Form answered",
                "description": "A response to a clinic form arrived: filled in by the team (validated), by the patient through the link or the portal, by the agent or by the website (stay «por_validar» until a professional decides). «alarme» means at least one answer matches a warning sign defined in the form (the team has already been alerted with an urgent task). The answers themselves never leave in the event.",
                "tags": [
                    "Formulários"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "formulario.respondido"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "resposta_id",
                                            "formulario_id",
                                            "tipo",
                                            "estado",
                                            "alarme",
                                            "respondido_em"
                                        ],
                                        "properties": {
                                            "resposta_id": {
                                                "type": "integer"
                                            },
                                            "formulario_id": {
                                                "type": "integer"
                                            },
                                            "tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "anamnese",
                                                    "questionario_previo",
                                                    "seguimento",
                                                    "satisfacao",
                                                    "pre_avaliacao",
                                                    "tecnica",
                                                    "triagem_sintomas",
                                                    "outro"
                                                ]
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "lead_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "estado": {
                                                "type": "string",
                                                "enum": [
                                                    "por_validar",
                                                    "validado"
                                                ]
                                            },
                                            "alarme": {
                                                "type": "boolean"
                                            },
                                            "respondido_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "formulario.respondido",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "resposta_id": 5120,
                                    "formulario_id": 31,
                                    "tipo": "questionario_previo",
                                    "paciente_id": 1204,
                                    "lead_id": null,
                                    "estado": "por_validar",
                                    "alarme": false,
                                    "respondido_em": "2026-10-29T08:47:13+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "proposta.enviada": {
            "post": {
                "summary": "Proposal sent",
                "description": "First sending of a sealed proposal to the patient (re-sends do not fire the event).",
                "tags": [
                    "Comercial"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "proposta.enviada"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "proposta_id",
                                            "numero",
                                            "estado",
                                            "total",
                                            "moeda"
                                        ],
                                        "properties": {
                                            "proposta_id": {
                                                "type": "integer"
                                            },
                                            "numero": {
                                                "type": "string"
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "lead_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "episodio_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "estado": {
                                                "type": "string",
                                                "enum": [
                                                    "rascunho",
                                                    "enviada",
                                                    "vista",
                                                    "aceite",
                                                    "recusada",
                                                    "expirada"
                                                ]
                                            },
                                            "opcao": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "Key of the accepted option (only in proposta.aceite)."
                                            },
                                            "total": {
                                                "type": "number",
                                                "x-unidade": "EUR"
                                            },
                                            "moeda": {
                                                "const": "EUR"
                                            },
                                            "moeda_paciente": {
                                                "type": "string",
                                                "description": "Currency the proposal was presented in (indicative)."
                                            },
                                            "cambio": {
                                                "type": "number"
                                            },
                                            "aceite_em": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            },
                                            "impressao_digital": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "SHA-256 of the sealed content."
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "proposta.enviada",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "proposta_id": 57,
                                    "numero": "PR-2026-0057",
                                    "paciente_id": 12,
                                    "lead_id": 88,
                                    "episodio_id": 31,
                                    "estado": "enviada",
                                    "opcao": null,
                                    "total": 6900,
                                    "moeda": "EUR",
                                    "moeda_paciente": "EUR",
                                    "cambio": 1,
                                    "aceite_em": null,
                                    "impressao_digital": "9f2c4e1a7b3d5f60c8a9e2b4d6f8a0c1e3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "proposta.aceite": {
            "post": {
                "summary": "Proposal accepted",
                "description": "The patient accepted the proposal through the personal link, the portal or in person. Sends the accepted option; the payment plan has already been created.",
                "tags": [
                    "Comercial"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "proposta.aceite"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "proposta_id",
                                            "numero",
                                            "estado",
                                            "total",
                                            "moeda"
                                        ],
                                        "properties": {
                                            "proposta_id": {
                                                "type": "integer"
                                            },
                                            "numero": {
                                                "type": "string"
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "lead_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "episodio_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "estado": {
                                                "type": "string",
                                                "enum": [
                                                    "rascunho",
                                                    "enviada",
                                                    "vista",
                                                    "aceite",
                                                    "recusada",
                                                    "expirada"
                                                ]
                                            },
                                            "opcao": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "Key of the accepted option (only in proposta.aceite)."
                                            },
                                            "total": {
                                                "type": "number",
                                                "x-unidade": "EUR"
                                            },
                                            "moeda": {
                                                "const": "EUR"
                                            },
                                            "moeda_paciente": {
                                                "type": "string",
                                                "description": "Currency the proposal was presented in (indicative)."
                                            },
                                            "cambio": {
                                                "type": "number"
                                            },
                                            "aceite_em": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            },
                                            "impressao_digital": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "SHA-256 of the sealed content."
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "proposta.aceite",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "estado": "aceite",
                                    "opcao": "recomendada",
                                    "aceite_em": "2026-11-04T16:20:11+00:00",
                                    "proposta_id": 57,
                                    "numero": "PR-2026-0057",
                                    "paciente_id": 12,
                                    "lead_id": 88,
                                    "episodio_id": 31,
                                    "total": 6900,
                                    "moeda": "EUR",
                                    "moeda_paciente": "EUR",
                                    "cambio": 1,
                                    "impressao_digital": "9f2c4e1a7b3d5f60c8a9e2b4d6f8a0c1e3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "proposta.recusada": {
            "post": {
                "summary": "Proposal declined",
                "description": "The proposal was declined by the patient or recorded as declined by the team. Includes the stated reason (free text, without clinical data).",
                "tags": [
                    "Comercial"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "proposta.recusada"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "proposta_id",
                                            "numero",
                                            "estado",
                                            "total",
                                            "moeda"
                                        ],
                                        "properties": {
                                            "proposta_id": {
                                                "type": "integer"
                                            },
                                            "numero": {
                                                "type": "string"
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "lead_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "episodio_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "estado": {
                                                "type": "string",
                                                "enum": [
                                                    "rascunho",
                                                    "enviada",
                                                    "vista",
                                                    "aceite",
                                                    "recusada",
                                                    "expirada"
                                                ]
                                            },
                                            "opcao": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "Key of the accepted option (only in proposta.aceite)."
                                            },
                                            "total": {
                                                "type": "number",
                                                "x-unidade": "EUR"
                                            },
                                            "moeda": {
                                                "const": "EUR"
                                            },
                                            "moeda_paciente": {
                                                "type": "string",
                                                "description": "Currency the proposal was presented in (indicative)."
                                            },
                                            "cambio": {
                                                "type": "number"
                                            },
                                            "aceite_em": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            },
                                            "impressao_digital": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "SHA-256 of the sealed content."
                                            },
                                            "motivo": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "proposta.recusada",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "estado": "recusada",
                                    "motivo": "Prefere adiar para o próximo ano.",
                                    "proposta_id": 57,
                                    "numero": "PR-2026-0057",
                                    "paciente_id": 12,
                                    "lead_id": 88,
                                    "episodio_id": 31,
                                    "opcao": null,
                                    "total": 6900,
                                    "moeda": "EUR",
                                    "moeda_paciente": "EUR",
                                    "cambio": 1,
                                    "aceite_em": null,
                                    "impressao_digital": "9f2c4e1a7b3d5f60c8a9e2b4d6f8a0c1e3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "pagamento.recebido": {
            "post": {
                "summary": "Payment received",
                "description": "A payment became paid: confirmed by the provider (notification or status check) or marked as paid by the team (till, bank transfer).",
                "tags": [
                    "Comercial"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "pagamento.recebido"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "pagamento_id",
                                            "tipo",
                                            "valor",
                                            "moeda"
                                        ],
                                        "properties": {
                                            "pagamento_id": {
                                                "type": "integer"
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "episodio_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "proposta_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "sinal",
                                                    "intercalar",
                                                    "restante",
                                                    "consulta",
                                                    "teleconsulta",
                                                    "tratamento",
                                                    "outro",
                                                    "adiantamento",
                                                    "pre_pagamento",
                                                    "vale",
                                                    "comparticipacao"
                                                ]
                                            },
                                            "metodo": {
                                                "type": "string",
                                                "enum": [
                                                    "mbway",
                                                    "multibanco",
                                                    "cartao",
                                                    "numerario",
                                                    "transferencia",
                                                    "ligacao",
                                                    "financiamento",
                                                    "carteira",
                                                    "vale"
                                                ],
                                                "description": "«carteira» and «vale»: settled with wallet balance or a voucher (not new money)."
                                            },
                                            "valor": {
                                                "type": "number",
                                                "x-unidade": "EUR"
                                            },
                                            "moeda": {
                                                "const": "EUR"
                                            },
                                            "pago_em": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            },
                                            "confirmacao": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "enum": [
                                                    "callback",
                                                    "api",
                                                    "manual",
                                                    null
                                                ]
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "pagamento.recebido",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "pagamento_id": 204,
                                    "paciente_id": 12,
                                    "episodio_id": 31,
                                    "proposta_id": 57,
                                    "tipo": "sinal",
                                    "metodo": "mbway",
                                    "valor": 1380,
                                    "moeda": "EUR",
                                    "pago_em": "2026-11-04T16:24:52+00:00",
                                    "confirmacao": "callback"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "documento_fiscal.emitido": {
            "post": {
                "summary": "Tax document issued",
                "description": "The certified invoicing software issued a document (invoice, invoice-receipt, simplified invoice or credit note), or an issue made in another program was recorded.",
                "tags": [
                    "Comercial"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "documento_fiscal.emitido"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "documento_id",
                                            "tipo",
                                            "total",
                                            "moeda"
                                        ],
                                        "properties": {
                                            "documento_id": {
                                                "type": "integer"
                                            },
                                            "tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "FT",
                                                    "FR",
                                                    "FS",
                                                    "RG",
                                                    "NC"
                                                ]
                                            },
                                            "numero": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "atcud": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "conta_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ],
                                                "description": "Paying account the document was issued to."
                                            },
                                            "pagamento_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "total": {
                                                "type": "number",
                                                "x-unidade": "EUR"
                                            },
                                            "moeda": {
                                                "const": "EUR"
                                            },
                                            "emitido_em": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "documento_fiscal.emitido",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "documento_id": 91,
                                    "tipo": "FR",
                                    "numero": "FR A2026/118",
                                    "atcud": "JJ3KX9QW-118",
                                    "paciente_id": 12,
                                    "pagamento_id": 204,
                                    "total": 1380,
                                    "moeda": "EUR",
                                    "emitido_em": "2026-11-04T16:25:30+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "consentimento.revogado": {
            "post": {
                "summary": "Consent withdrawn",
                "description": "A patient or contact withdrew a consent (in the portal, with the team or through an erasure request). Internal effects (contact objection, stopping sequences, removing published images) are already applied when the event is sent; external systems using the same purpose must stop doing so.",
                "tags": [
                    "Consentimentos"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "consentimento.revogado"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "consentimento_id",
                                            "finalidade",
                                            "revogado_em"
                                        ],
                                        "properties": {
                                            "consentimento_id": {
                                                "type": "integer"
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "lead_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "finalidade": {
                                                "type": "string",
                                                "enum": [
                                                    "tratamento_clinico",
                                                    "fotografias_clinicas",
                                                    "imagens_comunicacao",
                                                    "captura_3d",
                                                    "gravacao_chamadas",
                                                    "gravacao_video",
                                                    "ia",
                                                    "agente_voz",
                                                    "marketing",
                                                    "partilha_terceiros",
                                                    "teleconsulta",
                                                    "cirurgico",
                                                    "contacto"
                                                ]
                                            },
                                            "revogado_em": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "consentimento.revogado",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "consentimento_id": 5610,
                                    "paciente_id": 1204,
                                    "lead_id": null,
                                    "finalidade": "marketing",
                                    "revogado_em": "2026-10-28T15:42:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "documento.emitido": {
            "post": {
                "summary": "Document issued",
                "description": "A document was issued from a template (instructions, statement, report, discharge, consent information…). It carries no content; the verification code allows checking the document at GET /conformidade/verificar/{codigo}.",
                "tags": [
                    "Documentos"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "documento.emitido"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "documento_id",
                                            "tipo",
                                            "codigo_verificacao",
                                            "emitido_em"
                                        ],
                                        "properties": {
                                            "documento_id": {
                                                "type": "integer"
                                            },
                                            "numero": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "proposta",
                                                    "consentimento",
                                                    "instrucoes",
                                                    "declaracao",
                                                    "relatorio",
                                                    "alta",
                                                    "carta"
                                                ]
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "codigo_verificacao": {
                                                "type": "string"
                                            },
                                            "emitido_em": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "documento.emitido",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "documento_id": 902,
                                    "numero": "DOC-2026-0142",
                                    "tipo": "instrucoes",
                                    "paciente_id": 1204,
                                    "codigo_verificacao": "K7QM-3XRA",
                                    "emitido_em": "2026-10-28T09:58:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "documento.assinado": {
            "post": {
                "summary": "Document signed",
                "description": "A document was signed: on screen (in person), with a one-time code through the link sent to the holder, by the patient in the portal, or with an uploaded qualified signature. The certificate is available at GET /conformidade/documentos/{id}.",
                "tags": [
                    "Documentos"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "documento.assinado"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "documento_id",
                                            "tipo",
                                            "assinatura_tipo",
                                            "assinado_em"
                                        ],
                                        "properties": {
                                            "documento_id": {
                                                "type": "integer"
                                            },
                                            "numero": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "tipo": {
                                                "type": "string"
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "assinatura_tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "ecra",
                                                    "codigo",
                                                    "qualificada"
                                                ]
                                            },
                                            "assinado_em": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "documento.assinado",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "documento_id": 902,
                                    "numero": "DOC-2026-0142",
                                    "tipo": "instrucoes",
                                    "paciente_id": 1204,
                                    "assinatura_tipo": "codigo",
                                    "assinado_em": "2026-10-28T18:20:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "pedido_titular.recebido": {
            "post": {
                "summary": "Data-subject request received",
                "description": "An access, rectification, portability, erasure, objection or restriction request was recorded (through the portal or by the team). The legal response deadline starts on receipt.",
                "tags": [
                    "Proteção de dados"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "pedido_titular.recebido"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "pedido_id",
                                            "tipo",
                                            "recebido_em"
                                        ],
                                        "properties": {
                                            "pedido_id": {
                                                "type": "integer"
                                            },
                                            "tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "acesso",
                                                    "retificacao",
                                                    "portabilidade",
                                                    "apagamento",
                                                    "oposicao",
                                                    "limitacao"
                                                ]
                                            },
                                            "paciente_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "recebido_em": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "pedido_titular.recebido",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "pedido_id": 41,
                                    "tipo": "portabilidade",
                                    "paciente_id": 1204,
                                    "recebido_em": "2026-10-28T11:03:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "reclamacao.recebida": {
            "post": {
                "summary": "Complaint, compliment or suggestion received",
                "description": "An entry from the Complaints Book (paper or electronic), email, portal or phone was recorded, with the reply deadline in working days. It carries neither the text nor the complainant data.",
                "tags": [
                    "Proteção de dados"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "reclamacao.recebida"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "reclamacao_id",
                                            "tipo"
                                        ],
                                        "properties": {
                                            "reclamacao_id": {
                                                "type": "integer"
                                            },
                                            "numero": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "reclamacao",
                                                    "elogio",
                                                    "sugestao"
                                                ]
                                            },
                                            "canal": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "enum": [
                                                    "fisico",
                                                    "eletronico",
                                                    "email",
                                                    "portal",
                                                    "telefone",
                                                    null
                                                ]
                                            },
                                            "prazo": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "reclamacao.recebida",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "reclamacao_id": 18,
                                    "numero": "REC-2026-0018",
                                    "tipo": "reclamacao",
                                    "canal": "eletronico",
                                    "prazo": "2026-11-11"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "incidente.registado": {
            "post": {
                "summary": "Security incident recorded",
                "description": "A security incident or personal data breach was recorded. prazo_cnpd is the end of the 72 hours from detection for a possible notification to the supervisory authority.",
                "tags": [
                    "Proteção de dados"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "incidente.registado"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "incidente_id"
                                        ],
                                        "properties": {
                                            "incidente_id": {
                                                "type": "integer"
                                            },
                                            "gravidade": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "enum": [
                                                    "baixa",
                                                    "media",
                                                    "alta",
                                                    "critica",
                                                    null
                                                ]
                                            },
                                            "detetado_em": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            },
                                            "prazo_cnpd": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "incidente.registado",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "incidente_id": 3,
                                    "gravidade": "alta",
                                    "detetado_em": "2026-10-28T08:15:00+00:00",
                                    "prazo_cnpd": "2026-10-31T08:15:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "lead.criado": {
            "post": {
                "summary": "Lead created",
                "description": "A new lead came in (website, ad, message, call, voice agent or created by the team). When the contact already existed as an open lead with the same phone or email there is no new event: the existing lead is updated.",
                "tags": [
                    "Funil e leads"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "lead.criado"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "origem",
                                            "criado_em"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "origem": {
                                                "type": "string",
                                                "enum": [
                                                    "site",
                                                    "pre_avaliacao",
                                                    "meta",
                                                    "google",
                                                    "whatsapp",
                                                    "instagram",
                                                    "messenger",
                                                    "telefone",
                                                    "presencial",
                                                    "recomendacao",
                                                    "agente_voz",
                                                    "outro"
                                                ]
                                            },
                                            "fase": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "Stage key (e.g. novo)."
                                            },
                                            "campanha": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "utm": {
                                                "type": "object",
                                                "properties": {
                                                    "source": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "medium": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "campaign": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "term": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "content": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                }
                                            },
                                            "procedimento_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "responsavel_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "idioma": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "pontuacao": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 100
                                            },
                                            "criado_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "lead.criado",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 812,
                                    "origem": "meta",
                                    "fase": "novo",
                                    "campanha": "capilar-outono",
                                    "utm": {
                                        "source": "facebook",
                                        "medium": "cpc",
                                        "campaign": "capilar-outono",
                                        "term": null,
                                        "content": "video-15s"
                                    },
                                    "procedimento_id": 3,
                                    "responsavel_id": 14,
                                    "idioma": "pt-PT",
                                    "pontuacao": 40,
                                    "criado_em": "2026-10-28T08:47:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "lead.fase_alterada": {
            "post": {
                "summary": "Lead changed stage",
                "description": "The lead moved to another funnel stage (dragged on the board, via the API, from a call outcome or automatically when the doctor validates feasibility). For «lost» stages it includes the loss reason. Useful to send conversions back to ad platforms.",
                "tags": [
                    "Funil e leads"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "lead.fase_alterada"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "lead_id",
                                            "fase",
                                            "fase_tipo",
                                            "em"
                                        ],
                                        "properties": {
                                            "lead_id": {
                                                "type": "integer"
                                            },
                                            "fase": {
                                                "type": "string",
                                                "description": "New stage key."
                                            },
                                            "fase_tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "aberta",
                                                    "ganha",
                                                    "perdida"
                                                ]
                                            },
                                            "motivo_perda": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "enum": [
                                                    "preco",
                                                    "prazo",
                                                    "concorrencia",
                                                    "nao_elegivel",
                                                    "sem_resposta",
                                                    "outro",
                                                    null
                                                ]
                                            },
                                            "em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "lead.fase_alterada",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "lead_id": 812,
                                    "fase": "consulta_marcada",
                                    "fase_tipo": "aberta",
                                    "motivo_perda": null,
                                    "em": "2026-10-29T10:12:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "lead.convertido": {
            "post": {
                "summary": "Lead converted to patient",
                "description": "The lead became a patient (created from the lead data or already existing) and the episode was opened. Source and campaign stay on the patient to measure marketing return.",
                "tags": [
                    "Funil e leads"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "lead.convertido"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "lead_id",
                                            "paciente_id",
                                            "convertido_em"
                                        ],
                                        "properties": {
                                            "lead_id": {
                                                "type": "integer"
                                            },
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "convertido_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "lead.convertido",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "lead_id": 812,
                                    "paciente_id": 1204,
                                    "convertido_em": "2026-10-30T16:40:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "campanha.enviada": {
            "post": {
                "summary": "Campaign sent",
                "description": "An approved campaign finished sending (all batches processed). Totals are available at GET /marketing/campanhas/{id}/estatisticas.",
                "tags": [
                    "Campanhas de marketing"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "campanha.enviada"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "campanha_id",
                                            "canal",
                                            "enviada_em"
                                        ],
                                        "properties": {
                                            "campanha_id": {
                                                "type": "integer"
                                            },
                                            "canal": {
                                                "type": "string",
                                                "enum": [
                                                    "email",
                                                    "sms",
                                                    "whatsapp"
                                                ]
                                            },
                                            "enviada_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "campanha.enviada",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "campanha_id": 21,
                                    "canal": "email",
                                    "enviada_em": "2026-11-03T10:24:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "tarefa.criada": {
            "post": {
                "summary": "Task created",
                "description": "A task was created (manually, from chat, through the API or automatically by a module using the M7 service).",
                "tags": [
                    "Tarefas"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "tarefa.criada"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "titulo": {
                                                "type": "string"
                                            },
                                            "prioridade": {
                                                "type": "string",
                                                "enum": [
                                                    "baixa",
                                                    "normal",
                                                    "alta",
                                                    "urgente"
                                                ]
                                            },
                                            "prazo": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            },
                                            "responsavel_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "origem": {
                                                "type": "string",
                                                "enum": [
                                                    "manual",
                                                    "automatica",
                                                    "mensagem",
                                                    "agente"
                                                ]
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "tarefa.criada",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 87,
                                    "titulo": "Ligar à Rita Matos",
                                    "prioridade": "alta",
                                    "prazo": "2026-10-29T10:00:00+00:00",
                                    "responsavel_id": 4,
                                    "origem": "manual"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "tarefa.concluida": {
            "post": {
                "summary": "Task completed",
                "description": "A task was completed (reopening does not fire an event).",
                "tags": [
                    "Tarefas"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "tarefa.concluida"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "titulo": {
                                                "type": "string"
                                            },
                                            "concluida_por": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "concluida_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            "origem": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "tarefa.concluida",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 87,
                                    "titulo": "Ligar à Rita Matos",
                                    "concluida_por": 4,
                                    "concluida_em": "2026-10-29T09:41:00+00:00",
                                    "origem": "manual"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "comunicado.publicado": {
            "post": {
                "summary": "Internal notice published",
                "description": "A team notice was published. Only title and audience — the text stays in AnagenSys.",
                "tags": [
                    "Comunicados"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "comunicado.publicado"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "titulo": {
                                                "type": "string"
                                            },
                                            "publico": {
                                                "type": "string",
                                                "enum": [
                                                    "todos",
                                                    "departamento",
                                                    "perfil"
                                                ]
                                            },
                                            "destino": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "exige_leitura": {
                                                "type": "boolean"
                                            },
                                            "publicado_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "comunicado.publicado",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 3,
                                    "titulo": "Novo protocolo de esterilização",
                                    "publico": "departamento",
                                    "destino": "enfermagem",
                                    "exige_leitura": true,
                                    "publicado_em": "2026-10-27T08:00:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "exportacao.concluida": {
            "post": {
                "summary": "Full export ready",
                "description": "The requested full export is ready to download (by the team, in the platform). The event carries no data nor links.",
                "tags": [
                    "Exportação"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "exportacao.concluida"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "tabelas": {
                                                "type": "integer"
                                            },
                                            "tamanho": {
                                                "type": "integer",
                                                "x-unidade": "bytes"
                                            },
                                            "sha256": {
                                                "type": "string"
                                            },
                                            "expira_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "exportacao.concluida",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 4,
                                    "tabelas": 63,
                                    "tamanho": 18452211,
                                    "sha256": "9f2c…a71b",
                                    "expira_em": "2026-11-04T03:10:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "webhook.teste": {
            "post": {
                "summary": "Test delivery",
                "description": "Sent when the clinic presses «Test» on the endpoint. Reply 2xx.",
                "tags": [
                    "Integrações"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "webhook.teste"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "properties": {
                                            "mensagem": {
                                                "type": "string"
                                            },
                                            "webhook_id": {
                                                "type": "integer"
                                            },
                                            "pedido_por": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "webhook.teste",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "mensagem": "Entrega de teste do AnagenSys.",
                                    "webhook_id": 2,
                                    "pedido_por": 4
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "plano.aprovado": {
            "post": {
                "summary": "Surgical plan approved",
                "description": "A doctor approved a plan version. The previous approved version of the same plan became «substituted». The SHA-256 fingerprint seals input, parameters, engine version and result.",
                "tags": [
                    "Planos cirúrgicos"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "plano.aprovado"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "paciente_id",
                                            "versao",
                                            "impressao_digital"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "episodio_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "versao": {
                                                "type": "integer"
                                            },
                                            "motor_versao": {
                                                "type": "integer"
                                            },
                                            "enxertos": {
                                                "type": "integer",
                                                "x-unidade": "enxertos"
                                            },
                                            "sessoes": {
                                                "type": "integer",
                                                "x-unidade": "sessões"
                                            },
                                            "impressao_digital": {
                                                "type": "string",
                                                "pattern": "^[a-f0-9]{64}$"
                                            },
                                            "aprovado_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "plano.aprovado",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 318,
                                    "paciente_id": 1204,
                                    "episodio_id": 77,
                                    "versao": 3,
                                    "motor_versao": 2,
                                    "enxertos": 3200,
                                    "sessoes": 2,
                                    "impressao_digital": "b1946ac92492d2347c6235b4d2611184e7a4b8f3c2d1e0f9a8b7c6d5e4f3a2b1",
                                    "aprovado_em": "2026-10-28T11:42:05+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "motor.versao_aprovada": {
            "post": {
                "summary": "Engine parameters approved",
                "description": "The clinical board approved a version of the calculation engine parameters; it is now used for new calculations in the clinic.",
                "tags": [
                    "Motor de cálculo"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "motor.versao_aprovada"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "versao"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "versao": {
                                                "type": "integer"
                                            },
                                            "aprovado_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "motor.versao_aprovada",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 4,
                                    "versao": 2,
                                    "aprovado_em": "2026-10-28T09:15:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "marco.concluido": {
            "post": {
                "summary": "Follow-up milestone completed",
                "description": "A post-operative milestone (d1, s1, m1, m2, m6, m9, m12, m18) was completed. Includes the recommendation index (NPS) when recorded — useful to invite online reviews when satisfaction is high.",
                "tags": [
                    "Acompanhamento"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "marco.concluido"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "paciente_id",
                                            "marco"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "marco": {
                                                "type": "string",
                                                "enum": [
                                                    "d1",
                                                    "s1",
                                                    "m1",
                                                    "m2",
                                                    "m6",
                                                    "m9",
                                                    "m12",
                                                    "m18"
                                                ]
                                            },
                                            "nps": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ],
                                                "minimum": 0,
                                                "maximum": 10
                                            },
                                            "concluido_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "marco.concluido",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 5120,
                                    "paciente_id": 1204,
                                    "marco": "m12",
                                    "nps": 10,
                                    "concluido_em": "2027-10-30T16:02:11+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "execucao.areas_confirmadas": {
            "post": {
                "summary": "Day 0 areas confirmed",
                "description": "The recipient areas were measured again on the day of surgery and confirmed before starting. Identifiers and time only: areas and deviation stay in AnagenSys and the API.",
                "tags": [
                    "Análise e plano"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "execucao.areas_confirmadas"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "cirurgia_id",
                                            "paciente_id",
                                            "plano_id"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "cirurgia_id": {
                                                "type": "integer"
                                            },
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "plano_id": {
                                                "type": "integer"
                                            },
                                            "confirmadas_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "execucao.areas_confirmadas",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 88,
                                    "cirurgia_id": 412,
                                    "paciente_id": 1204,
                                    "plano_id": 3310,
                                    "confirmadas_em": "2026-11-03T08:12:40+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "portal.pedido_criado": {
            "post": {
                "summary": "Request created in the portal",
                "description": "The patient proposed contacts/allergies or exercised a data subject right (including deleting the account). Use the id to query the portal_pedidos resource.",
                "tags": [
                    "Portal do paciente"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "portal.pedido_criado"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "pedido_id",
                                            "paciente_id",
                                            "tipo"
                                        ],
                                        "properties": {
                                            "pedido_id": {
                                                "type": "integer"
                                            },
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "contactos",
                                                    "alergias",
                                                    "acesso",
                                                    "retificacao",
                                                    "portabilidade",
                                                    "apagamento",
                                                    "oposicao",
                                                    "limitacao",
                                                    "eliminar_conta"
                                                ]
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "portal.pedido_criado",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "pedido_id": 15,
                                    "paciente_id": 12,
                                    "tipo": "contactos"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "portal.consentimento_revogado": {
            "post": {
                "summary": "Permission withdrawn in the portal",
                "description": "The patient withdrew an optional permission; it takes effect immediately. Systems using that purpose (for example, marketing) must stop now.",
                "tags": [
                    "Portal do paciente"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "portal.consentimento_revogado"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "paciente_id",
                                            "finalidade",
                                            "consentimento_id"
                                        ],
                                        "properties": {
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "finalidade": {
                                                "type": "string"
                                            },
                                            "consentimento_id": {
                                                "type": "integer"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "portal.consentimento_revogado",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "paciente_id": 12,
                                    "finalidade": "marketing",
                                    "consentimento_id": 903
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "portal.documento_enviado": {
            "post": {
                "summary": "Document uploaded by the patient",
                "description": "Clinical file (encrypted) uploaded in the portal; retrieve it via GET /ficheiros/{id}/url with the appropriate permissions.",
                "tags": [
                    "Portal do paciente"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "portal.documento_enviado"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "paciente_id",
                                            "ficheiro_id",
                                            "tipo"
                                        ],
                                        "properties": {
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "ficheiro_id": {
                                                "type": "integer"
                                            },
                                            "tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "exame",
                                                    "analises",
                                                    "relatorio",
                                                    "receita",
                                                    "identificacao",
                                                    "outro"
                                                ]
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "portal.documento_enviado",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "paciente_id": 12,
                                    "ficheiro_id": 10101,
                                    "tipo": "analises"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "portal.fotos_enviadas": {
            "post": {
                "summary": "Follow-up photos uploaded",
                "description": "First photo of the day uploaded by the patient (one event per patient per day), linked to the milestone when given.",
                "tags": [
                    "Portal do paciente"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "portal.fotos_enviadas"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "paciente_id"
                                        ],
                                        "properties": {
                                            "paciente_id": {
                                                "type": "integer"
                                            },
                                            "marco_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "portal.fotos_enviadas",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "paciente_id": 12,
                                    "marco_id": 66
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "pre_avaliacao.recebida": {
            "post": {
                "summary": "Online assessment received",
                "description": "A person submitted the online assessment from the website, the app or an authorised external website. The lead, the medical review task and, with the chosen consultation, the appointment request were created. Use the id to query the pre_avaliacoes resource.",
                "tags": [
                    "Site público"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "pre_avaliacao.recebida"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "pre_avaliacao_id",
                                            "origem",
                                            "fotos"
                                        ],
                                        "properties": {
                                            "pre_avaliacao_id": {
                                                "type": "integer"
                                            },
                                            "lead_id": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ]
                                            },
                                            "origem": {
                                                "type": "string",
                                                "enum": [
                                                    "site",
                                                    "app",
                                                    "externo"
                                                ],
                                                "description": "externo: form embedded in an authorised website."
                                            },
                                            "idioma": {
                                                "type": "string",
                                                "enum": [
                                                    "pt",
                                                    "en"
                                                ]
                                            },
                                            "procedimento": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "Area of interest given (e.g. couro_cabeludo, barba)."
                                            },
                                            "consulta_modalidade": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "enum": [
                                                    "presencial",
                                                    "telefone",
                                                    "video",
                                                    null
                                                ],
                                                "description": "Consultation chosen by the person (creates the appointment request)."
                                            },
                                            "fotos": {
                                                "type": "integer",
                                                "description": "Number of photos sent."
                                            },
                                            "criado_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "pre_avaliacao.recebida",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "pre_avaliacao_id": 91,
                                    "lead_id": 402,
                                    "origem": "app",
                                    "idioma": "pt",
                                    "procedimento": "couro_cabeludo",
                                    "fotos": 4,
                                    "criado_em": "2026-10-28T08:05:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        },
        "demonstracao.pedida": {
            "post": {
                "summary": "AnagenSys demo requested",
                "description": "A clinic requested a demo on the presentation page or in the app. Fired only in the main clinic.",
                "tags": [
                    "Apresentação do AnagenSys"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "evento",
                                    "id",
                                    "criado_em",
                                    "dados"
                                ],
                                "properties": {
                                    "evento": {
                                        "const": "demonstracao.pedida"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "criado_em": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "clinica_id": {
                                        "type": "integer"
                                    },
                                    "dados": {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "clinica_nome",
                                            "origem"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "clinica_nome": {
                                                "type": "string"
                                            },
                                            "pais": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "pattern": "^[A-Z]{2}$"
                                            },
                                            "especialidade": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "enum": [
                                                    "capilar",
                                                    "dermatologia",
                                                    "estetica",
                                                    "cirurgia_plastica",
                                                    "dentaria",
                                                    "oftalmologia",
                                                    "outra",
                                                    null
                                                ]
                                            },
                                            "origem": {
                                                "type": "string",
                                                "enum": [
                                                    "site",
                                                    "app"
                                                ]
                                            },
                                            "criado_em": {
                                                "type": "string",
                                                "format": "date-time"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "evento": "demonstracao.pedida",
                                "id": "evt_6f1c2a",
                                "criado_em": "2026-10-28T10:15:00+00:00",
                                "clinica_id": 1,
                                "dados": {
                                    "id": 58,
                                    "clinica_nome": "Clínica Capilar do Norte",
                                    "pais": "PT",
                                    "especialidade": "capilar",
                                    "origem": "site",
                                    "criado_em": "2026-10-27T18:40:00+00:00"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Delivery acknowledged"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "utilizador": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "opaque",
                "description": "Team access token (POST /auth/entrar → 2FA → confidentiality term). Valid for 20 min; refresh with POST /auth/renovar."
            },
            "paciente": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "opaque",
                "description": "Patient portal token (POST /portal/auth/entrar)."
            },
            "integracao": {
                "type": "oauth2",
                "description": "OAuth 2.0 client credentials. Each «module:level» scope maps to one row of the permission matrix, with «all» scope inside the client clinic.",
                "flows": {
                    "clientCredentials": {
                        "tokenUrl": "https://anagen.pt/api/v1/oauth/token",
                        "scopes": {
                            "admin.utilizadores:ver": "Read: Users and access",
                            "admin.utilizadores:editar": "Read and write: Users and access",
                            "admin.definicoes:ver": "Read: Settings",
                            "admin.definicoes:editar": "Read and write: Settings",
                            "admin.auditoria:ver": "Read: Audit log",
                            "admin.auditoria:editar": "Read and write: Audit log",
                            "clinico.parametros:ver": "Read: Clinical parameters",
                            "clinico.parametros:editar": "Read and write: Clinical parameters",
                            "ficha.identificacao:ver": "Read: Patient identification",
                            "ficha.identificacao:editar": "Read and write: Patient identification",
                            "ficha.consentimentos:ver": "Read: Consents",
                            "ficha.consentimentos:editar": "Read and write: Consents",
                            "ficha.clinica:ver": "Read: Clinical record",
                            "ficha.clinica:editar": "Read and write: Clinical record",
                            "ficha.captura:ver": "Read: Capture and trichoscopy",
                            "ficha.captura:editar": "Read and write: Capture and trichoscopy",
                            "ficha.fotografias:ver": "Read: Clinical photographs",
                            "ficha.fotografias:editar": "Read and write: Clinical photographs",
                            "ficha.plano:ver": "Read: Surgical plan",
                            "ficha.plano:editar": "Read and write: Surgical plan",
                            "crm.leads:ver": "Read: Leads and funnel",
                            "crm.leads:editar": "Read and write: Leads and funnel",
                            "crm.atendimento:ver": "Read: Customer service",
                            "crm.atendimento:editar": "Read and write: Customer service",
                            "crm.telefonia:ver": "Read: Telephony",
                            "crm.telefonia:editar": "Read and write: Telephony",
                            "crm.agente:ver": "Read: Conversation agent",
                            "crm.agente:editar": "Read and write: Conversation agent",
                            "marketing:ver": "Read: Marketing",
                            "marketing:editar": "Read and write: Marketing",
                            "agenda:ver": "Read: Schedule",
                            "agenda:editar": "Read and write: Schedule",
                            "teleconsulta:ver": "Read: Teleconsultation",
                            "teleconsulta:editar": "Read and write: Teleconsultation",
                            "bloco.mapa:ver": "Read: Surgery board",
                            "bloco.mapa:editar": "Read and write: Surgery board",
                            "bloco.marcar:ver": "Read: Surgery booking",
                            "bloco.marcar:editar": "Read and write: Surgery booking",
                            "bloco.registo:ver": "Read: Surgical record",
                            "bloco.registo:editar": "Read and write: Surgical record",
                            "acompanhamento:ver": "Read: Follow-up",
                            "acompanhamento:editar": "Read and write: Follow-up",
                            "comercial.propostas:ver": "Read: Proposals",
                            "comercial.propostas:editar": "Read and write: Proposals",
                            "comercial.descontos:ver": "Read: Discounts",
                            "comercial.descontos:editar": "Read and write: Discounts",
                            "financeiro.pagamentos:ver": "Read: Payments",
                            "financeiro.pagamentos:editar": "Read and write: Payments",
                            "financeiro.valores:ver": "Read: Prices and commissions",
                            "financeiro.valores:editar": "Read and write: Prices and commissions",
                            "stock:ver": "Read: Stock",
                            "stock:editar": "Read and write: Stock",
                            "documentos:ver": "Read: Documents",
                            "documentos:editar": "Read and write: Documents",
                            "conformidade:ver": "Read: Compliance",
                            "conformidade:editar": "Read and write: Compliance",
                            "equipa.tarefas:ver": "Read: Tasks",
                            "equipa.tarefas:editar": "Read and write: Tasks",
                            "equipa.chat:ver": "Read: Team conversations",
                            "equipa.chat:editar": "Read and write: Team conversations",
                            "indicadores.financeiros:ver": "Read: Financial indicators",
                            "indicadores.financeiros:editar": "Read and write: Financial indicators",
                            "indicadores.vendas:ver": "Read: Sales indicators",
                            "indicadores.vendas:editar": "Read and write: Sales indicators",
                            "indicadores.operacionais:ver": "Read: Operational indicators",
                            "indicadores.operacionais:editar": "Read and write: Operational indicators",
                            "indicadores.atendimento:ver": "Read: Customer service indicators",
                            "indicadores.atendimento:editar": "Read and write: Customer service indicators",
                            "site.cms:ver": "Read: Website and content",
                            "site.cms:editar": "Read and write: Website and content"
                        }
                    }
                }
            }
        },
        "headers": {
            "XRequestId": {
                "description": "Request identifier (quote it when reporting issues).",
                "schema": {
                    "type": "string"
                }
            },
            "XRateLimitLimit": {
                "schema": {
                    "type": "integer"
                },
                "description": "Requests allowed per minute."
            },
            "XRateLimitRemaining": {
                "schema": {
                    "type": "integer"
                },
                "description": "Remaining requests in the window."
            },
            "XRateLimitReset": {
                "schema": {
                    "type": "integer"
                },
                "description": "Window end (epoch seconds)."
            },
            "RetryAfter": {
                "schema": {
                    "type": "integer"
                },
                "description": "Seconds until retrying."
            }
        },
        "parameters": {
            "Q": {
                "name": "q",
                "in": "query",
                "required": false,
                "schema": {
                    "type": "string",
                    "maxLength": 120
                },
                "description": "Free-text search."
            },
            "Ordem": {
                "name": "ordem",
                "in": "query",
                "required": false,
                "schema": {
                    "type": "string"
                },
                "example": "criado_em:desc,nome:asc",
                "description": "Sorting: field:asc|desc, comma separated (max 3)."
            },
            "Pagina": {
                "name": "pagina",
                "in": "query",
                "required": false,
                "schema": {
                    "type": "integer",
                    "minimum": 1,
                    "default": 1
                }
            },
            "PorPagina": {
                "name": "por_pagina",
                "in": "query",
                "required": false,
                "schema": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 25
                }
            },
            "IdempotencyKey": {
                "name": "Idempotency-Key",
                "in": "header",
                "required": false,
                "schema": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 120
                },
                "description": "Makes the POST safe to retry for 24 h (same key + different body → 409)."
            },
            "AcceptLanguage": {
                "name": "Accept-Language",
                "in": "header",
                "required": false,
                "schema": {
                    "type": "string",
                    "enum": [
                        "pt-PT",
                        "pt-BR",
                        "en",
                        "es",
                        "fr",
                        "de"
                    ]
                }
            },
            "XAxClinica": {
                "name": "X-AX-Clinica",
                "in": "header",
                "required": false,
                "schema": {
                    "type": "string",
                    "maxLength": 120
                },
                "example": "PORTO-HAIR",
                "description": "Public and patient requests: the clinic public code (without it, the clinic is resolved from the request domain). Team accounts with access to several clinics: numeric identifier of the clinic to use for this request."
            }
        },
        "schemas": {
            "Meta": {
                "type": "object",
                "properties": {
                    "pagina": {
                        "type": "integer"
                    },
                    "por_pagina": {
                        "type": "integer"
                    },
                    "total": {
                        "type": "integer"
                    }
                }
            },
            "Erro": {
                "type": "object",
                "required": [
                    "codigo",
                    "mensagem"
                ],
                "properties": {
                    "codigo": {
                        "type": "string",
                        "enum": [
                            "validacao",
                            "pedido_invalido",
                            "pedido_demasiado_grande",
                            "nao_autenticado",
                            "token_expirado",
                            "token_revogado",
                            "credenciais_invalidas",
                            "codigo_invalido",
                            "desafio_invalido",
                            "dois_fatores",
                            "conta_bloqueada",
                            "ip_nao_permitido",
                            "origem_nao_permitida",
                            "sem_permissao",
                            "nao_encontrado",
                            "ligacao_invalida",
                            "metodo_nao_permitido",
                            "conflito",
                            "acao_recusada",
                            "idempotencia_conflito",
                            "idempotencia_em_curso",
                            "limite_excedido",
                            "erro_interno"
                        ]
                    },
                    "mensagem": {
                        "type": "string"
                    },
                    "campos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        }
                    }
                },
                "x-catalogo-erros": {
                    "validacao": {
                        "http": 422,
                        "descricao": "Invalid data; see «campos»."
                    },
                    "pedido_invalido": {
                        "http": 400,
                        "descricao": "Malformed request (e.g. invalid JSON)."
                    },
                    "pedido_demasiado_grande": {
                        "http": 413,
                        "descricao": "Body exceeds the limit."
                    },
                    "nao_autenticado": {
                        "http": 401,
                        "descricao": "Missing or invalid token."
                    },
                    "token_expirado": {
                        "http": 401,
                        "descricao": "Access token expired: refresh it."
                    },
                    "token_revogado": {
                        "http": 401,
                        "descricao": "Token revoked (session ended or refresh reuse)."
                    },
                    "credenciais_invalidas": {
                        "http": 401,
                        "descricao": "Wrong email or password."
                    },
                    "codigo_invalido": {
                        "http": 401,
                        "descricao": "Wrong or expired code."
                    },
                    "desafio_invalido": {
                        "http": 401,
                        "descricao": "Invalid or expired sign-in challenge."
                    },
                    "dois_fatores": {
                        "http": 401,
                        "descricao": "Second factor required."
                    },
                    "conta_bloqueada": {
                        "http": 403,
                        "descricao": "Account temporarily locked."
                    },
                    "ip_nao_permitido": {
                        "http": 403,
                        "descricao": "Source address not allowed."
                    },
                    "origem_nao_permitida": {
                        "http": 403,
                        "descricao": "Origin (CORS) not allowed."
                    },
                    "sem_permissao": {
                        "http": 403,
                        "descricao": "Not allowed by the permission matrix."
                    },
                    "nao_encontrado": {
                        "http": 404,
                        "descricao": "Resource or record not found (or out of scope)."
                    },
                    "ligacao_invalida": {
                        "http": 404,
                        "descricao": "Public link not found, expired or already used."
                    },
                    "metodo_nao_permitido": {
                        "http": 405,
                        "descricao": "HTTP method not supported."
                    },
                    "conflito": {
                        "http": 409,
                        "descricao": "Current state prevents the operation."
                    },
                    "acao_recusada": {
                        "http": 409,
                        "descricao": "The action could not be performed."
                    },
                    "idempotencia_conflito": {
                        "http": 409,
                        "descricao": "Idempotency-Key reused with a different body."
                    },
                    "idempotencia_em_curso": {
                        "http": 409,
                        "descricao": "Request with the same Idempotency-Key in progress."
                    },
                    "limite_excedido": {
                        "http": 429,
                        "descricao": "Too many requests; see Retry-After."
                    },
                    "erro_interno": {
                        "http": 500,
                        "descricao": "Unexpected error (quote the X-Request-Id)."
                    }
                }
            },
            "RespostaErro": {
                "type": "object",
                "required": [
                    "ok",
                    "erro"
                ],
                "properties": {
                    "ok": {
                        "const": false
                    },
                    "erro": {
                        "$ref": "#/components/schemas/Erro"
                    }
                }
            },
            "Opcao": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "rotulo": {
                        "type": "string"
                    },
                    "subtitulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "ResultadoAcao": {
                "type": "object",
                "properties": {
                    "mensagem": {
                        "type": "string"
                    },
                    "dados": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "redirecionar": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "EsquemaRecurso": {
                "type": "object",
                "description": "Resource definition to render screens (fields, sections, actions, permissions).",
                "properties": {
                    "chave": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "singular": {
                        "type": "string"
                    },
                    "modulo": {
                        "type": "string"
                    },
                    "permissoes": {
                        "type": "object"
                    },
                    "campos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "seccoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "acoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "M6Erro": {
                "type": "object",
                "required": [
                    "codigo",
                    "mensagem"
                ],
                "properties": {
                    "codigo": {
                        "type": "string",
                        "enum": [
                            "validacao",
                            "nao_autenticado",
                            "sem_permissao",
                            "nao_encontrado",
                            "conflito",
                            "conflito_aviso",
                            "estado_invalido",
                            "nada_a_desfazer",
                            "consentimento_em_falta",
                            "aptidao_em_falta",
                            "relatorio_em_falta",
                            "lembrete_falhou",
                            "sem_contagens",
                            "sinais_vitais_em_falta",
                            "video_indisponivel",
                            "limite_excedido"
                        ]
                    },
                    "mensagem": {
                        "type": "string"
                    },
                    "campos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Field → message. In calendar conflicts, each field (inicio, fim, profissional_id, participantes, sala_id, recursos) joins the messages of that field conflicts."
                    }
                },
                "x-catalogo-erros": {
                    "conflito": {
                        "http": 409,
                        "descricao": "Blocking calendar conflict (person, room, resource, absence, notice). Cannot be forced."
                    },
                    "conflito_aviso": {
                        "http": 409,
                        "descricao": "Warnings only (holiday, outside hours, no hours, past). Resend with \"forcar\": true."
                    },
                    "estado_invalido": {
                        "http": 409,
                        "descricao": "The current status does not allow the operation."
                    },
                    "nada_a_desfazer": {
                        "http": 409,
                        "descricao": "No counts in the last 10 minutes."
                    },
                    "consentimento_em_falta": {
                        "http": 422,
                        "descricao": "Missing valid consent (teleconsultation, recording or surgical)."
                    },
                    "aptidao_em_falta": {
                        "http": 422,
                        "descricao": "Pre-operative fitness is not «apto»."
                    },
                    "relatorio_em_falta": {
                        "http": 422,
                        "descricao": "The teleconsultation only closes with a report."
                    },
                    "lembrete_falhou": {
                        "http": 422,
                        "descricao": "No channel delivered the reminder."
                    },
                    "sem_contagens": {
                        "http": 422,
                        "descricao": "Closing without graft counts."
                    },
                    "sinais_vitais_em_falta": {
                        "http": 422,
                        "descricao": "Closing without vital signs (when mandatory)."
                    },
                    "video_indisponivel": {
                        "http": 503,
                        "descricao": "The video service did not create the room."
                    }
                }
            },
            "M6RespostaErro": {
                "type": "object",
                "required": [
                    "ok",
                    "erro"
                ],
                "properties": {
                    "ok": {
                        "const": false
                    },
                    "erro": {
                        "$ref": "#/components/schemas/M6Erro"
                    }
                }
            },
            "M6TipoMarcacao": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "chave": {
                        "type": "string"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "duracao_min": {
                        "type": "integer",
                        "x-unidade": "min"
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "teleconsulta": {
                        "type": "boolean"
                    },
                    "cirurgia": {
                        "type": "boolean"
                    },
                    "sala_obrigatoria": {
                        "type": "boolean"
                    },
                    "exige_sinal": {
                        "type": "boolean",
                        "description": "Requires a deposit (pending payment in the commercial module)."
                    },
                    "margem_antes_min": {
                        "type": "integer",
                        "x-unidade": "min",
                        "description": "Preparation before (takes calendar time)."
                    },
                    "margem_depois_min": {
                        "type": "integer",
                        "x-unidade": "min",
                        "description": "Cleaning after (takes calendar time)."
                    },
                    "online": {
                        "type": "boolean",
                        "description": "Can be booked by the patient (portal, site, agent)."
                    }
                }
            },
            "M6Profissional": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "perfil": {
                        "type": "string"
                    },
                    "departamento": {
                        "type": "string"
                    }
                }
            },
            "M6Recurso": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Language (interpreters)."
                    },
                    "bloco": {
                        "type": "boolean",
                        "description": "Operating theatre room."
                    },
                    "capacidade": {
                        "type": "integer",
                        "description": "Simultaneous bookings."
                    }
                }
            },
            "M6ConfiguracaoAgenda": {
                "type": "object",
                "properties": {
                    "tipos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6TipoMarcacao"
                        }
                    },
                    "profissionais": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Profissional"
                        },
                        "description": "Calendar columns: with working hours or from the medical, nursing or technical department."
                    },
                    "equipa": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Profissional"
                        },
                        "description": "Whole active staff (participants)."
                    },
                    "salas": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Recurso"
                        }
                    },
                    "equipamentos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Recurso"
                        }
                    },
                    "interpretes": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Recurso"
                        }
                    },
                    "hora_inicio": {
                        "type": "integer",
                        "x-unidade": "h"
                    },
                    "hora_fim": {
                        "type": "integer",
                        "x-unidade": "h"
                    },
                    "estados": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "valor": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "tom": {
                                    "type": "string",
                                    "enum": [
                                        "sucesso",
                                        "marca",
                                        "neutro",
                                        "perigo",
                                        "ouro",
                                        "aviso"
                                    ]
                                }
                            }
                        }
                    },
                    "pode_editar": {
                        "type": "boolean"
                    }
                }
            },
            "M6Evento": {
                "type": "object",
                "required": [
                    "id",
                    "titulo",
                    "inicio",
                    "fim",
                    "tipo"
                ],
                "description": "Calendar event. «tipo» marcacao carries the appointment fields; margem carries marcacao_id; ausencia and feriado carry diaInteiro. Never editable except appointments in pedido/marcada/confirmada for calendar editors.",
                "properties": {
                    "id": {
                        "type": [
                            "integer",
                            "string"
                        ],
                        "description": "Integer for appointments; «margem-<id>-antes|depois», «ausencia-<id>», «feriado-<id>» for the others."
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "marcacao",
                            "margem",
                            "ausencia",
                            "feriado"
                        ]
                    },
                    "titulo": {
                        "type": "string",
                        "description": "Patient or lead name (appointments)."
                    },
                    "subtitulo": {
                        "type": "string"
                    },
                    "inicio": {
                        "type": "string",
                        "description": "ISO 8601 with offset; holidays carry the date only (YYYY-MM-DD)."
                    },
                    "fim": {
                        "type": "string"
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "#RRGGBB or a design-system token (var(--ax-…))."
                    },
                    "recurso": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Professional or room, according to «colunas»."
                    },
                    "url": {
                        "type": "null"
                    },
                    "editavel": {
                        "type": "boolean"
                    },
                    "diaInteiro": {
                        "type": "boolean"
                    },
                    "marcacao_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pedido",
                            "marcada",
                            "confirmada",
                            "em_curso",
                            "concluida",
                            "faltou",
                            "cancelada",
                            "remarcada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "tipo_id": {
                        "type": "integer"
                    },
                    "tipo_nome": {
                        "type": "string"
                    },
                    "tipo_cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "profissional_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "profissional_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "profissional_cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "sala_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "sala_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "teleconsulta": {
                        "type": "boolean"
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "confirmada": {
                        "type": "boolean"
                    }
                }
            },
            "M6Conflito": {
                "type": "object",
                "required": [
                    "codigo",
                    "mensagem",
                    "bloqueante",
                    "campo"
                ],
                "properties": {
                    "codigo": {
                        "type": "string",
                        "enum": [
                            "validacao",
                            "intervalo_invalido",
                            "pessoa_ocupada",
                            "sala_ocupada",
                            "recurso_ocupado",
                            "ausencia",
                            "recurso_indisponivel",
                            "antecedencia",
                            "feriado",
                            "passado",
                            "sem_horario",
                            "fora_horario"
                        ],
                        "description": "Blocking: intervalo_invalido, pessoa_ocupada, sala_ocupada (above capacity), recurso_ocupado, ausencia, recurso_indisponivel, antecedencia (origin portal/site/agent), validacao. Warnings: feriado, passado, fora_horario, sem_horario — feriado, passado and fora_horario become blocking when the origin is portal, site or agent."
                    },
                    "mensagem": {
                        "type": "string"
                    },
                    "bloqueante": {
                        "type": "boolean"
                    },
                    "campo": {
                        "type": "string",
                        "enum": [
                            "inicio",
                            "fim",
                            "tipo_id",
                            "paciente_id",
                            "profissional_id",
                            "participantes",
                            "sala_id",
                            "recursos"
                        ]
                    },
                    "marcacao_id": {
                        "type": "integer",
                        "description": "Colliding appointment (when applicable)."
                    },
                    "utilizador_id": {
                        "type": "integer"
                    },
                    "recurso_id": {
                        "type": "integer"
                    }
                }
            },
            "M6Vaga": {
                "type": "object",
                "properties": {
                    "inicio": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "fim": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "profissional_id": {
                        "type": "integer"
                    },
                    "profissional_nome": {
                        "type": "string"
                    },
                    "sala_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Free room assigned (types with mandatory room or surgery, or the working-hours room)."
                    },
                    "sala_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "M6Ocupacao": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "horas_disponiveis": {
                        "type": "number",
                        "x-unidade": "h"
                    },
                    "horas_ocupadas": {
                        "type": "number",
                        "x-unidade": "h"
                    },
                    "percentagem": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100,
                        "x-unidade": "%"
                    },
                    "marcacoes": {
                        "type": "integer"
                    },
                    "receita": {
                        "type": "number",
                        "x-moeda": "EUR",
                        "description": "Estimated revenue (only with «financeiro.valores» scope «all»)."
                    }
                }
            },
            "M6Marcacao": {
                "type": "object",
                "description": "Appointment detail (no clinical content).",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pedido",
                            "marcada",
                            "confirmada",
                            "em_curso",
                            "concluida",
                            "faltou",
                            "cancelada",
                            "remarcada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "estado_tom": {
                        "type": "string",
                        "enum": [
                            "sucesso",
                            "marca",
                            "neutro",
                            "perigo",
                            "ouro",
                            "aviso"
                        ]
                    },
                    "origem": {
                        "type": "string",
                        "enum": [
                            "equipa",
                            "portal",
                            "site",
                            "agente",
                            "telefone"
                        ]
                    },
                    "origem_rotulo": {
                        "type": "string"
                    },
                    "inicio": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "fim": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "duracao_min": {
                        "type": "integer",
                        "x-unidade": "min"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "paciente_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "lead_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Surgical block from the surgery map."
                    },
                    "tipo_id": {
                        "type": "integer"
                    },
                    "tipo_nome": {
                        "type": "string"
                    },
                    "tipo_cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "teleconsulta": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "estado": {
                                "type": "string",
                                "enum": [
                                    "agendada",
                                    "sala_espera",
                                    "em_curso",
                                    "terminada",
                                    "fechada"
                                ]
                            },
                            "estado_rotulo": {
                                "type": "string"
                            }
                        }
                    },
                    "profissional_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "profissional_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "profissional_cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "sala_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "sala_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "recursos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "tipo": {
                                    "type": "string",
                                    "enum": [
                                        "equipamento",
                                        "interprete"
                                    ]
                                }
                            }
                        }
                    },
                    "participantes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "utilizador_id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "papel": {
                                    "type": "string"
                                },
                                "cor": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "pattern": "^#[0-9A-F]{6}$"
                                }
                            }
                        }
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Administrative notes."
                    },
                    "confirmada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "confirmacao_canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "equipa",
                            "ligacao",
                            "telefone",
                            "portal",
                            "sms",
                            "whatsapp",
                            "email",
                            null
                        ]
                    },
                    "lembrete_enviado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "checkin_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "posto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "admissao",
                            "preparacao",
                            "extracao",
                            "implantacao",
                            "recobro",
                            "saida",
                            null
                        ]
                    },
                    "atraso_minutos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "min",
                        "description": "Delay reported by the patient."
                    },
                    "motivo_cancelamento": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "remarcada_de": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "remarcacoes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "inicio": {
                                    "type": "string",
                                    "format": "date-time"
                                }
                            }
                        },
                        "description": "Chain of previous appointments (up to 10)."
                    },
                    "politica": {
                        "type": "string",
                        "description": "Type cancellation policy."
                    },
                    "historico": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "acao": {
                                    "type": "string",
                                    "enum": [
                                        "criada",
                                        "movida",
                                        "estado",
                                        "remarcada",
                                        "lembrete",
                                        "confirmacao",
                                        "posto",
                                        "atraso",
                                        "oferta"
                                    ]
                                },
                                "descricao": {
                                    "type": "string"
                                },
                                "autor": {
                                    "type": "string"
                                },
                                "criado_em": {
                                    "type": "string",
                                    "format": "date-time"
                                }
                            }
                        }
                    },
                    "acoes": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "confirmar",
                                "chegou",
                                "concluir",
                                "faltou",
                                "remarcar",
                                "cancelar",
                                "lembrete"
                            ]
                        },
                        "description": "Actions available to the caller (empty without «agenda» edit)."
                    }
                }
            },
            "M6ResultadoMover": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "inicio": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",
                        "description": "Clinic local time, without offset."
                    },
                    "fim": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$"
                    },
                    "avisos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Conflito"
                        }
                    }
                }
            },
            "M6ResultadoEstado": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "confirmada",
                            "em_curso",
                            "concluida",
                            "faltou",
                            "cancelada"
                        ]
                    },
                    "mensagem": {
                        "type": "string"
                    },
                    "tarefa_id": {
                        "type": "integer",
                        "description": "Recovery task created (no-show)."
                    },
                    "fora_da_politica": {
                        "type": "boolean",
                        "description": "Cancellation requested by the patient outside the type notice (cancel)."
                    },
                    "marcacao": {
                        "$ref": "#/components/schemas/M6Marcacao"
                    }
                }
            },
            "M6ListaEspera": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "nome": {
                        "type": "string"
                    },
                    "tipo_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "tipo_nome": {
                        "type": "string"
                    },
                    "profissional_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "preferencias": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Day and time preferences."
                    },
                    "prioridade": {
                        "type": "string",
                        "enum": [
                            "alta",
                            "normal",
                            "baixa"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "ativa",
                            "contactado"
                        ]
                    },
                    "desde": {
                        "type": "string",
                        "description": "Date the entry was added."
                    },
                    "oferta_inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "Offered slot (status «contactado»)."
                    }
                }
            },
            "M6CartaoFluxo": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "Appointment."
                    },
                    "nome": {
                        "type": "string"
                    },
                    "nome_curto": {
                        "type": "string"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "hora": {
                        "type": "string",
                        "pattern": "^\\d{2}:\\d{2}$"
                    },
                    "inicio": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "tipo_nome": {
                        "type": "string"
                    },
                    "tipo_cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "profissional_nome": {
                        "type": "string"
                    },
                    "profissional_cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "sala_nome": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string"
                    },
                    "confirmada": {
                        "type": "boolean"
                    },
                    "posto_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "Entry into the current station."
                    },
                    "atrasado": {
                        "type": "boolean",
                        "description": "Still to arrive more than 10 minutes after the time."
                    },
                    "atraso_minutos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "min"
                    }
                }
            },
            "M6Fluxo": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "string",
                        "format": "date"
                    },
                    "colunas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string",
                                    "enum": [
                                        "por_chegar",
                                        "admissao",
                                        "preparacao",
                                        "extracao",
                                        "implantacao",
                                        "recobro",
                                        "saida"
                                    ]
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "cartoes": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/M6CartaoFluxo"
                                    }
                                }
                            }
                        }
                    },
                    "resumo": {
                        "type": "object",
                        "properties": {
                            "total": {
                                "type": "integer"
                            },
                            "por_chegar": {
                                "type": "integer"
                            },
                            "em_fluxo": {
                                "type": "integer"
                            },
                            "saida": {
                                "type": "integer"
                            },
                            "atrasados": {
                                "type": "integer"
                            },
                            "medias_min": {
                                "type": "object",
                                "additionalProperties": {
                                    "type": "integer"
                                },
                                "x-unidade": "min",
                                "description": "Station → average minutes in the station."
                            }
                        }
                    }
                }
            },
            "M6SalaEspera": {
                "type": "object",
                "properties": {
                    "atendidos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "nome": {
                                    "type": "string",
                                    "description": "First name and surname initial."
                                },
                                "sala": {
                                    "type": "string"
                                },
                                "hora": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "seguintes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "nome": {
                                    "type": "string"
                                },
                                "sala": {
                                    "type": "string"
                                },
                                "hora": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "hora": {
                        "type": "string",
                        "pattern": "^\\d{2}:\\d{2}$"
                    }
                }
            },
            "M6Sincronizacao": {
                "type": "object",
                "properties": {
                    "ativa": {
                        "type": "boolean"
                    },
                    "prefixo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "First 8 characters of the token."
                    },
                    "ultimo_uso_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "M6FicheiroLigacao": {
                "type": "object",
                "properties": {
                    "ficheiro_id": {
                        "type": "integer"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Signed link valid for 15 minutes."
                    }
                }
            },
            "M6TeleconsultaLinha": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "marcacao_id": {
                        "type": "integer"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "paciente_nome": {
                        "type": "string"
                    },
                    "medico_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "medico_nome": {
                        "type": "string"
                    },
                    "inicio": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "fim": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "agendada",
                            "sala_espera",
                            "em_curso",
                            "terminada",
                            "fechada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "estado_tom": {
                        "type": "string",
                        "enum": [
                            "aviso",
                            "marca",
                            "info",
                            "sucesso",
                            "neutro"
                        ]
                    },
                    "sala_espera_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "relatorio_ok": {
                        "type": "boolean"
                    }
                }
            },
            "M6Presente": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": "string"
                    },
                    "papel": {
                        "type": "string",
                        "enum": [
                            "paciente",
                            "acompanhante",
                            "medico",
                            "interprete",
                            "outro"
                        ]
                    },
                    "relacao": {
                        "type": "string"
                    },
                    "registado_em": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "M6Teleconsulta": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "marcacao_id": {
                        "type": "integer"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "agendada",
                            "sala_espera",
                            "em_curso",
                            "terminada",
                            "fechada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "estado_tom": {
                        "type": "string"
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "paciente_nome": {
                        "type": "string"
                    },
                    "medico_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "medico_nome": {
                        "type": "string"
                    },
                    "consentimento": {
                        "type": "boolean",
                        "description": "Valid teleconsultation consent."
                    },
                    "consentimento_gravacao": {
                        "type": "boolean",
                        "description": "Valid recording consent."
                    },
                    "gravacao_permitida": {
                        "type": "boolean"
                    },
                    "sala_espera_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "admitido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "identidade_metodo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "documento",
                            "conhecido",
                            "dados_pessoais",
                            null
                        ]
                    },
                    "identidade_confirmada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "identidade_confirmada_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "presentes": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Presente"
                        }
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Key of the video service where the room was created."
                    },
                    "video_configurado": {
                        "type": "boolean"
                    },
                    "video_fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Key of the video service active in Settings."
                    },
                    "sala_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "description": "Host address (only for those running the session and while not closed)."
                    },
                    "inicio_real": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "fim_real": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "relatorio_visivel": {
                        "type": "boolean",
                        "description": "The caller has access to the patient clinical record."
                    },
                    "relatorio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Only with clinical record access (audited read)."
                    },
                    "relatorio_origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "equipa",
                            "assistente",
                            null
                        ]
                    },
                    "relatorio_fechado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "comprovativo_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "relatorio_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "capturas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "ficheiro_id": {
                                    "type": "integer"
                                },
                                "criado_em": {
                                    "type": "string",
                                    "format": "date-time"
                                }
                            }
                        }
                    },
                    "assistente": {
                        "type": "boolean",
                        "description": "The Assistant («escriba» use) is configured and available to the caller."
                    },
                    "pode_editar": {
                        "type": "boolean"
                    },
                    "passos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string",
                                    "enum": [
                                        "consentimento",
                                        "sala_espera",
                                        "admitido",
                                        "identidade",
                                        "presentes",
                                        "relatorio",
                                        "fechada"
                                    ]
                                },
                                "feito": {
                                    "type": "boolean"
                                }
                            }
                        }
                    }
                }
            },
            "M6PropostaRelatorio": {
                "type": "object",
                "properties": {
                    "ok": {
                        "type": "boolean"
                    },
                    "texto": {
                        "type": "string",
                        "description": "Draft for the doctor to review (not saved)."
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "AI service that answered (send back in ia_fornecedor)."
                    },
                    "modelo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Model used (send back in ia_modelo)."
                    },
                    "pedido_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Assistant request (send back in ia_pedido_id)."
                    },
                    "erro": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "M6Indicador": {
                "type": "object",
                "properties": {
                    "chave": {
                        "type": "string",
                        "enum": [
                            "confirmada",
                            "sinal",
                            "consentimento",
                            "analises",
                            "checklist"
                        ]
                    },
                    "rotulo": {
                        "type": "string"
                    },
                    "ok": {
                        "type": "boolean"
                    }
                }
            },
            "M6MembroEquipa": {
                "type": "object",
                "properties": {
                    "utilizador_id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "papel": {
                        "type": "string",
                        "enum": [
                            "cirurgiao",
                            "assistente",
                            "enfermeiro",
                            "tecnico",
                            "anestesista"
                        ]
                    },
                    "papel_rotulo": {
                        "type": "string"
                    },
                    "honorarios_valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-moeda": "EUR",
                        "description": "Person fees on this surgery. In the map detail it is only returned with «financeiro.valores» (scope «all»: everyone; otherwise only own)."
                    }
                }
            },
            "M6Cirurgia": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "numero": {
                        "type": "string",
                        "description": "Surgery number (used to confirm closing)."
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pre_marcada",
                            "reservada",
                            "validada",
                            "confirmada",
                            "em_curso",
                            "concluida",
                            "cancelada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "estado_tom": {
                        "type": "string",
                        "enum": [
                            "neutro",
                            "ouro",
                            "info",
                            "sucesso",
                            "marca",
                            "perigo"
                        ]
                    },
                    "paciente_id": {
                        "type": "integer"
                    },
                    "paciente_nome": {
                        "type": "string"
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "proposta_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "plano_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "marcacao_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Matching calendar block."
                    },
                    "sala_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "sala_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "inicio_previsto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "fim_previsto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra",
                            null
                        ]
                    },
                    "enxertos_planeados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos"
                    },
                    "aptidao": {
                        "type": "string",
                        "enum": [
                            "por_avaliar",
                            "apto",
                            "nao_apto"
                        ]
                    },
                    "aptidao_rotulo": {
                        "type": "string"
                    },
                    "validada_por": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Name of the validator."
                    },
                    "validada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "confirmada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "indicadores": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Indicador"
                        }
                    },
                    "equipa": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6MembroEquipa"
                        }
                    },
                    "valor_ato": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-moeda": "EUR",
                        "description": "Only with «financeiro.valores» (scope «all», or on surgeries the person takes part in or reserved)."
                    },
                    "valores_visiveis": {
                        "type": "boolean"
                    },
                    "enxertos_extraidos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos"
                    },
                    "enxertos_implantados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos"
                    },
                    "cabelos_total": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "cabelos"
                    },
                    "fechada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "motivo_cancelamento": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "acoes": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "reservar",
                                "equipa",
                                "aptidao",
                                "validar",
                                "confirmar",
                                "analises",
                                "cancelar",
                                "painel",
                                "checklist"
                            ]
                        },
                        "description": "Actions available to the caller."
                    },
                    "checklists": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Checklist"
                        },
                        "description": "Pre-operative checklists (in the detail and after reserving or creating checklists)."
                    }
                }
            },
            "M6EventoMapa": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "subtitulo": {
                        "type": "string",
                        "description": "Status · indicators done/5 · team."
                    },
                    "inicio": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "fim": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Surgeon colour (pre-booked: neutral token)."
                    },
                    "recurso": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Room."
                    },
                    "url": {
                        "type": "null"
                    },
                    "editavel": {
                        "type": "boolean"
                    },
                    "numero": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pre_marcada",
                            "reservada",
                            "validada",
                            "confirmada",
                            "em_curso",
                            "concluida"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "estado_tom": {
                        "type": "string"
                    },
                    "paciente_id": {
                        "type": "integer"
                    },
                    "paciente_nome": {
                        "type": "string"
                    },
                    "sala_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "enxertos_planeados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos"
                    },
                    "indicadores": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Indicador"
                        }
                    },
                    "indicadores_ok": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 5
                    },
                    "equipa": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "utilizador_id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "cor": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "pattern": "^#[0-9A-F]{6}$"
                                },
                                "papel": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "M6CirurgiaPorAgendar": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "numero": {
                        "type": "string"
                    },
                    "paciente_id": {
                        "type": "integer"
                    },
                    "paciente_nome": {
                        "type": "string"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "enxertos_planeados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos"
                    },
                    "sinal_pago": {
                        "type": "boolean"
                    },
                    "desde": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "M6Escala": {
                "type": "object",
                "properties": {
                    "dias": {
                        "type": "array",
                        "minItems": 7,
                        "maxItems": 7,
                        "items": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "utilizador": {
                                    "$ref": "#/components/schemas/M6Profissional"
                                },
                                "dias": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "data": {
                                                "type": "string",
                                                "format": "date"
                                            },
                                            "itens": {
                                                "type": "array",
                                                "items": {
                                                    "type": "object",
                                                    "properties": {
                                                        "cirurgia_id": {
                                                            "type": "integer"
                                                        },
                                                        "numero": {
                                                            "type": "string"
                                                        },
                                                        "hora": {
                                                            "type": "string",
                                                            "description": "Start–end (HH:MM–HH:MM)."
                                                        },
                                                        "sala": {
                                                            "type": "string"
                                                        },
                                                        "papel": {
                                                            "type": "string",
                                                            "description": "Role (label)."
                                                        },
                                                        "estado": {
                                                            "type": "string"
                                                        }
                                                    }
                                                }
                                            },
                                            "ausencia": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "Approved absence type on that day."
                                            }
                                        }
                                    }
                                },
                                "total": {
                                    "type": "integer",
                                    "description": "Person surgeries in the week."
                                }
                            }
                        }
                    }
                }
            },
            "M6OcupacaoBloco": {
                "type": "object",
                "properties": {
                    "sala_id": {
                        "type": "integer"
                    },
                    "sala_nome": {
                        "type": "string"
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "horas_disponiveis": {
                        "type": "number",
                        "x-unidade": "h"
                    },
                    "horas_usadas": {
                        "type": "number",
                        "x-unidade": "h"
                    },
                    "percentagem": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100,
                        "x-unidade": "%"
                    },
                    "cirurgias": {
                        "type": "integer"
                    }
                }
            },
            "M6ResultadoReserva": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "Surgery."
                    },
                    "inicio": {
                        "type": "string",
                        "description": "Clinic local time, without offset."
                    },
                    "fim": {
                        "type": "string"
                    },
                    "recurso": {
                        "type": "integer",
                        "description": "Room."
                    },
                    "avisos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Conflito"
                        }
                    },
                    "mensagem": {
                        "type": "string"
                    },
                    "cirurgia": {
                        "$ref": "#/components/schemas/M6Cirurgia"
                    }
                }
            },
            "M6ChecklistItem": {
                "type": "object",
                "properties": {
                    "texto": {
                        "type": "string"
                    },
                    "responsavel_papel": {
                        "type": "string",
                        "description": "Responsible role (cirurgiao, enfermeiro, …)."
                    },
                    "obrigatorio": {
                        "type": "boolean"
                    },
                    "feito": {
                        "type": "boolean"
                    },
                    "feito_por": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "feito_por_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "feito_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "M6Checklist": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "fase": {
                        "type": "string",
                        "enum": [
                            "pre_operatorio",
                            "admissao",
                            "desenho",
                            "anestesia",
                            "extracao",
                            "implantacao",
                            "penso",
                            "alta"
                        ]
                    },
                    "fase_rotulo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "aberta",
                            "concluida"
                        ]
                    },
                    "itens": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6ChecklistItem"
                        }
                    },
                    "feitos": {
                        "type": "integer"
                    },
                    "total": {
                        "type": "integer"
                    },
                    "concluida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "M6EnxertosPorTipo": {
                "type": "object",
                "description": "Grafts by FU type: \"1\", \"2\", \"3\" and \"4\" (4 = 4 or more hairs; for the hair total it counts as Settings › Theatre › hairs of FU 4, minimum 4).",
                "x-unidade": "enxertos",
                "properties": {
                    "1": {
                        "type": "integer"
                    },
                    "2": {
                        "type": "integer"
                    },
                    "3": {
                        "type": "integer"
                    },
                    "4": {
                        "type": "integer"
                    }
                }
            },
            "M6ContagemMomento": {
                "type": "object",
                "properties": {
                    "por_tipo": {
                        "$ref": "#/components/schemas/M6EnxertosPorTipo"
                    },
                    "total": {
                        "type": "integer",
                        "x-unidade": "enxertos"
                    },
                    "cabelos": {
                        "type": "integer",
                        "x-unidade": "cabelos"
                    },
                    "cabelos_por_enxerto": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "cabelos/enxerto"
                    }
                }
            },
            "M6ContagemOperador": {
                "type": "object",
                "properties": {
                    "operador_id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9A-F]{6}$"
                    },
                    "extracao": {
                        "type": "integer",
                        "x-unidade": "enxertos"
                    },
                    "implantacao": {
                        "type": "integer",
                        "x-unidade": "enxertos"
                    },
                    "por_tipo": {
                        "$ref": "#/components/schemas/M6EnxertosPorTipo"
                    },
                    "por_hora": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos/h",
                        "description": "Pace between the first and last count (minimum 15 min)."
                    }
                }
            },
            "M6Contagens": {
                "type": "object",
                "properties": {
                    "extracao": {
                        "$ref": "#/components/schemas/M6ContagemMomento"
                    },
                    "implantacao": {
                        "$ref": "#/components/schemas/M6ContagemMomento"
                    },
                    "por_operador": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6ContagemOperador"
                        }
                    }
                }
            },
            "M6UltimaContagem": {
                "type": [
                    "object",
                    "null"
                ],
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo_uf": {
                        "type": "integer",
                        "enum": [
                            1,
                            2,
                            3,
                            4
                        ]
                    },
                    "momento": {
                        "type": "string",
                        "enum": [
                            "extracao",
                            "implantacao"
                        ]
                    },
                    "operador": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "M6Progresso": {
                "type": "object",
                "properties": {
                    "extraido_pct": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 100,
                        "x-unidade": "%"
                    },
                    "implantado_pct": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 100,
                        "x-unidade": "%"
                    }
                }
            },
            "M6ResumoContagem": {
                "type": "object",
                "properties": {
                    "contagens": {
                        "$ref": "#/components/schemas/M6Contagens"
                    },
                    "planeado": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos"
                    },
                    "progresso": {
                        "$ref": "#/components/schemas/M6Progresso"
                    },
                    "ultima_contagem": {
                        "$ref": "#/components/schemas/M6UltimaContagem"
                    }
                }
            },
            "M6Fase": {
                "type": "object",
                "properties": {
                    "fase": {
                        "type": "string",
                        "enum": [
                            "admissao",
                            "desenho",
                            "anestesia",
                            "extracao",
                            "implantacao",
                            "penso",
                            "alta"
                        ]
                    },
                    "rotulo": {
                        "type": "string"
                    },
                    "duracao_seg": {
                        "type": "integer",
                        "x-unidade": "s",
                        "description": "Duration without pauses."
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "atual": {
                        "type": "boolean"
                    },
                    "feita": {
                        "type": "boolean"
                    }
                }
            },
            "M6Lote": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "lote": {
                        "type": "string"
                    },
                    "quantidade": {
                        "type": "integer",
                        "x-unidade": "enxertos"
                    },
                    "operador": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "extraido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "implantado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "horas_fora": {
                        "type": "number",
                        "x-unidade": "h",
                        "description": "Time out of body (until implantation or until now)."
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "ok",
                            "aviso",
                            "perigo"
                        ]
                    }
                }
            },
            "M6Transeccao": {
                "type": "object",
                "properties": {
                    "sessao_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "%"
                    },
                    "amostras": {
                        "type": "integer"
                    },
                    "observados": {
                        "type": "integer",
                        "x-unidade": "enxertos"
                    },
                    "por_operador": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "operador_id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "pct": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "%"
                                },
                                "observados": {
                                    "type": "integer",
                                    "x-unidade": "enxertos"
                                }
                            }
                        }
                    }
                }
            },
            "M6PlanoBloco": {
                "type": [
                    "object",
                    "null"
                ],
                "description": "Approved plan summary of the episode (with «ficha.plano» summary).",
                "properties": {
                    "id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "enxertos_necessarios": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos"
                    },
                    "capacidade_sessao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos"
                    },
                    "zonas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "zona": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "area_cm2": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "cm²"
                                },
                                "densidade_alvo": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "UF/cm²"
                                },
                                "enxertos": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "x-unidade": "enxertos"
                                }
                            }
                        }
                    }
                }
            },
            "M6EnfSinaisVitais": {
                "type": "object",
                "description": "At least one value.",
                "properties": {
                    "tas": {
                        "type": "number",
                        "minimum": 40,
                        "maximum": 260,
                        "x-unidade": "mmHg",
                        "description": "Systolic blood pressure."
                    },
                    "tad": {
                        "type": "number",
                        "minimum": 20,
                        "maximum": 160,
                        "x-unidade": "mmHg",
                        "description": "Diastolic blood pressure."
                    },
                    "fc": {
                        "type": "number",
                        "minimum": 20,
                        "maximum": 250,
                        "x-unidade": "bpm"
                    },
                    "spo2": {
                        "type": "number",
                        "minimum": 50,
                        "maximum": 100,
                        "x-unidade": "%"
                    },
                    "temperatura": {
                        "type": "number",
                        "minimum": 30,
                        "maximum": 43,
                        "x-unidade": "°C"
                    },
                    "fr": {
                        "type": "number",
                        "minimum": 4,
                        "maximum": 60,
                        "x-unidade": "cpm",
                        "description": "Respiratory rate."
                    }
                }
            },
            "M6EnfFarmaco": {
                "type": "object",
                "required": [
                    "nome",
                    "dose"
                ],
                "properties": {
                    "nome": {
                        "type": "string",
                        "maxLength": 120
                    },
                    "dose": {
                        "type": "number",
                        "minimum": 0.001,
                        "maximum": 100000
                    },
                    "unidade": {
                        "type": "string",
                        "enum": [
                            "mg",
                            "ml",
                            "mcg",
                            "UI",
                            "g"
                        ],
                        "default": "mg"
                    },
                    "concentracao_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0.01,
                        "maximum": 100,
                        "x-unidade": "%",
                        "description": "Mandatory for lidocaine in ml (1 % = 10 mg/ml)."
                    },
                    "via": {
                        "type": "string",
                        "enum": [
                            "local",
                            "subcutanea",
                            "endovenosa",
                            "oral",
                            "intramuscular",
                            "topica",
                            "inalatoria"
                        ],
                        "default": "local"
                    },
                    "hora": {
                        "type": "string",
                        "pattern": "^\\d{2}:\\d{2}$",
                        "description": "Default: current time."
                    },
                    "lote": {
                        "type": "string",
                        "maxLength": 40
                    },
                    "adrenalina": {
                        "type": "boolean",
                        "description": "With adrenaline (lidocaine limit of 7 mg/kg when all had it)."
                    },
                    "artigo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Stock item (consumption recorded on closing)."
                    }
                }
            },
            "M6EnfDor": {
                "type": "object",
                "required": [
                    "escala"
                ],
                "properties": {
                    "escala": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 10
                    },
                    "local": {
                        "type": "string",
                        "maxLength": 120
                    }
                }
            },
            "M6EnfIncidente": {
                "type": "object",
                "required": [
                    "descricao"
                ],
                "properties": {
                    "descricao": {
                        "type": "string",
                        "maxLength": 2000
                    },
                    "gravidade": {
                        "type": "string",
                        "enum": [
                            "baixa",
                            "media",
                            "alta"
                        ],
                        "default": "baixa"
                    },
                    "medidas": {
                        "type": "string",
                        "maxLength": 2000
                    }
                }
            },
            "M6EnfNota": {
                "type": "object",
                "required": [
                    "texto"
                ],
                "properties": {
                    "texto": {
                        "type": "string",
                        "maxLength": 4000
                    },
                    "zona": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "Scalp zone worked on."
                    }
                }
            },
            "M6RegistoEnfermagem": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "sinais_vitais",
                            "farmaco",
                            "dor",
                            "incidente",
                            "nota"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "dados": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/M6EnfSinaisVitais"
                            },
                            {
                                "$ref": "#/components/schemas/M6EnfFarmaco"
                            },
                            {
                                "$ref": "#/components/schemas/M6EnfDor"
                            },
                            {
                                "$ref": "#/components/schemas/M6EnfIncidente"
                            },
                            {
                                "$ref": "#/components/schemas/M6EnfNota"
                            }
                        ]
                    },
                    "texto": {
                        "type": "string",
                        "description": "Readable summary for lists and timeline."
                    },
                    "autor": {
                        "type": "string"
                    },
                    "registado_em": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "anulado": {
                        "type": "boolean"
                    },
                    "motivo_anulacao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "M6Lidocaina": {
                "type": "object",
                "properties": {
                    "mg_total": {
                        "type": "number",
                        "x-unidade": "mg",
                        "description": "Cumulative dose (non-voided records)."
                    },
                    "mg_kg": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "mg/kg"
                    },
                    "limite": {
                        "type": "number",
                        "x-unidade": "mg/kg",
                        "description": "4.5 (or 7 with adrenaline on every administration), configurable."
                    },
                    "com_adrenalina": {
                        "type": "boolean"
                    },
                    "aviso_pct": {
                        "type": "number",
                        "x-unidade": "%",
                        "description": "Limit percentage from which a warning is raised."
                    },
                    "percentagem": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100,
                        "x-unidade": "%"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "ok",
                            "aviso",
                            "perigo",
                            "sem_peso"
                        ]
                    },
                    "peso_kg": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "kg"
                    }
                }
            },
            "M6Enfermagem": {
                "type": "object",
                "required": [
                    "visivel"
                ],
                "description": "With {visivel:false} the caller has no access to the patient clinical record and receives nothing else. Clinical read audited (at most once per person and surgery every 10 minutes).",
                "properties": {
                    "visivel": {
                        "type": "boolean"
                    },
                    "registos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6RegistoEnfermagem"
                        }
                    },
                    "lidocaina": {
                        "$ref": "#/components/schemas/M6Lidocaina"
                    },
                    "sinais_vitais": {
                        "type": "object",
                        "properties": {
                            "ultimo_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "intervalo_min": {
                                "type": "integer",
                                "x-unidade": "min",
                                "description": "Required interval between records (Settings › Theatre)."
                            },
                            "em_atraso": {
                                "type": "boolean"
                            }
                        }
                    },
                    "dor_ultima": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 10
                    },
                    "vias": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "valor": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "unidades": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "M6Alta": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "instrucoes": {
                        "type": "string"
                    },
                    "medicacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Only with clinical record access."
                    },
                    "medicacao_visivel": {
                        "type": "boolean"
                    },
                    "contacto_urgencia": {
                        "type": "string"
                    },
                    "primeira_lavagem": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "marcacao_id": {
                                "type": "integer"
                            },
                            "inicio": {
                                "type": "string",
                                "format": "date-time"
                            },
                            "estado": {
                                "type": "string"
                            }
                        }
                    },
                    "enxertos_por_tipo": {
                        "$ref": "#/components/schemas/M6EnxertosPorTipo"
                    },
                    "total_cabelos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "cabelos"
                    },
                    "folha_entregue_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "certificado_garantia": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "documento_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "registada_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "registada_em": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "M6Painel": {
                "type": "object",
                "properties": {
                    "cirurgia": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "numero": {
                                "type": "string"
                            },
                            "estado": {
                                "type": "string",
                                "enum": [
                                    "pre_marcada",
                                    "reservada",
                                    "validada",
                                    "confirmada",
                                    "em_curso",
                                    "concluida",
                                    "cancelada"
                                ]
                            },
                            "estado_rotulo": {
                                "type": "string"
                            },
                            "estado_tom": {
                                "type": "string"
                            },
                            "paciente_id": {
                                "type": "integer"
                            },
                            "paciente_nome": {
                                "type": "string"
                            },
                            "sala_nome": {
                                "type": "string"
                            },
                            "tecnica": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "inicio_previsto": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "inicio_real": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "fim_real": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "fase_atual": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "admissao",
                                    "desenho",
                                    "anestesia",
                                    "extracao",
                                    "implantacao",
                                    "penso",
                                    "alta",
                                    null
                                ]
                            },
                            "pausada": {
                                "type": "boolean"
                            },
                            "pausada_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "decorrido_seg": {
                                "type": "integer",
                                "x-unidade": "s",
                                "description": "Session time without pauses."
                            },
                            "peso_kg": {
                                "type": [
                                    "number",
                                    "null"
                                ],
                                "x-unidade": "kg"
                            },
                            "consentimento": {
                                "type": "boolean",
                                "description": "Valid surgical consent."
                            }
                        }
                    },
                    "fases": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Fase"
                        }
                    },
                    "equipa": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6MembroEquipa"
                        }
                    },
                    "operadores": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6MembroEquipa"
                        },
                        "description": "Team members who can count (surgeon, assistant, technician, nurse)."
                    },
                    "contagens": {
                        "$ref": "#/components/schemas/M6Contagens"
                    },
                    "planeado": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos"
                    },
                    "progresso": {
                        "$ref": "#/components/schemas/M6Progresso"
                    },
                    "ultima_contagem": {
                        "$ref": "#/components/schemas/M6UltimaContagem"
                    },
                    "lotes": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Lote"
                        }
                    },
                    "tempo_fora": {
                        "type": "object",
                        "properties": {
                            "alerta_h": {
                                "type": "number",
                                "x-unidade": "h"
                            },
                            "maximo_h": {
                                "type": "number",
                                "x-unidade": "h"
                            }
                        }
                    },
                    "transeccao": {
                        "$ref": "#/components/schemas/M6Transeccao"
                    },
                    "plano": {
                        "$ref": "#/components/schemas/M6PlanoBloco"
                    },
                    "enfermagem": {
                        "$ref": "#/components/schemas/M6Enfermagem"
                    },
                    "checklists": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6Checklist"
                        }
                    },
                    "alta": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/M6Alta"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "permissoes": {
                        "type": "object",
                        "properties": {
                            "registar": {
                                "type": "boolean",
                                "description": "Can record (confirmed or in progress)."
                            },
                            "abrir": {
                                "type": "boolean"
                            },
                            "fechar": {
                                "type": "boolean"
                            },
                            "enfermagem": {
                                "type": "boolean",
                                "description": "Can record nursing (clinical record access and open session)."
                            }
                        }
                    },
                    "voz_palavras": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "description": "Words recognised by voice counting (\"1\"–\"4\" and \"desfazer\"), in pt, en, es, fr and de."
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "M6CirurgiaDoDia": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "numero": {
                        "type": "string"
                    },
                    "paciente_nome": {
                        "type": "string"
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "sala_nome": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "validada",
                            "confirmada",
                            "em_curso",
                            "concluida"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "estado_tom": {
                        "type": "string"
                    },
                    "fase_atual": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "enxertos_planeados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "equipa": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M6MembroEquipa"
                        }
                    }
                }
            },
            "M6EfeitosFecho": {
                "type": "object",
                "description": "Result of each service called on closing: ok, erro (logged on the server; closing stands) or indisponivel (module not installed).",
                "properties": {
                    "marcos": {
                        "type": "string",
                        "enum": [
                            "ok",
                            "erro",
                            "indisponivel"
                        ]
                    },
                    "honorarios": {
                        "type": "string",
                        "enum": [
                            "ok",
                            "erro",
                            "indisponivel"
                        ]
                    },
                    "stock": {
                        "type": "string",
                        "enum": [
                            "ok",
                            "erro",
                            "indisponivel"
                        ]
                    },
                    "episodio": {
                        "type": "string",
                        "enum": [
                            "ok",
                            "erro",
                            "indisponivel"
                        ],
                        "description": "Only when the surgery has an episode."
                    },
                    "webhook": {
                        "type": "string",
                        "enum": [
                            "ok",
                            "erro",
                            "indisponivel"
                        ]
                    }
                }
            },
            "M1Erro": {
                "type": "object",
                "required": [
                    "codigo",
                    "mensagem"
                ],
                "properties": {
                    "codigo": {
                        "type": "string",
                        "enum": [
                            "validacao",
                            "pedido_invalido",
                            "pedido_demasiado_grande",
                            "nao_encontrado",
                            "ligacao_invalida",
                            "limite_excedido",
                            "erro_interno"
                        ]
                    },
                    "mensagem": {
                        "type": "string"
                    },
                    "campos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        }
                    }
                },
                "x-catalogo-erros": {
                    "ligacao_invalida": {
                        "http": 404,
                        "descricao": "Malformed, unknown or expired token, or a request already answered."
                    }
                }
            },
            "M1RespostaErro": {
                "type": "object",
                "required": [
                    "ok",
                    "erro"
                ],
                "properties": {
                    "ok": {
                        "const": false
                    },
                    "erro": {
                        "$ref": "#/components/schemas/M1Erro"
                    }
                }
            },
            "M1Ligacao": {
                "type": "object",
                "description": "Block link: web path (relative to the clinic address) and app route.",
                "properties": {
                    "web": {
                        "type": "string"
                    },
                    "app": {
                        "type": "string"
                    }
                }
            },
            "M1Bloco": {
                "type": "object",
                "required": [
                    "tipo"
                ],
                "additionalProperties": true,
                "description": "Block in the single record and dashboard format: kpis {itens:[{rotulo, valor, unidade?, delta?, tom?, ligacao?}]}, lista {itens:[{titulo, subtitulo?, estado?, data?, icone?, ligacao?}], vazio}, campos {itens:[{rotulo, valor, unidade?, tom?}]}, grafico {grafico, valores:[{x, y, serie?}], unidade?}, galeria {itens:[{ficheiro_id, legenda?, data?}]}, cronologia {itens:[{titulo, descricao?, data, categoria}]}, alerta {tom, texto}, jornada {etapa, episodio_id}, acoes {itens:[{rotulo, icone, ligacao, tom?}]}.",
                "properties": {
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "kpis",
                            "lista",
                            "campos",
                            "grafico",
                            "galeria",
                            "cronologia",
                            "alerta",
                            "jornada",
                            "acoes"
                        ]
                    },
                    "itens": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "tom": {
                        "type": "string",
                        "enum": [
                            "marca",
                            "ouro",
                            "sucesso",
                            "aviso",
                            "perigo",
                            "info",
                            "neutro"
                        ]
                    }
                }
            },
            "M1PacienteMinimo": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "numero": {
                        "type": "string"
                    },
                    "nome_completo": {
                        "type": "string"
                    },
                    "idade": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "sexo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "F",
                            "M",
                            "X",
                            null
                        ]
                    }
                }
            },
            "M1Alerta": {
                "type": "object",
                "x-anagen-permissao": "ficha.clinica",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "alergia",
                            "medicacao",
                            "condicao",
                            "anticoagulante",
                            "outro"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "gravidade": {
                        "type": "string",
                        "enum": [
                            "baixa",
                            "media",
                            "alta"
                        ]
                    },
                    "gravidade_rotulo": {
                        "type": "string"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Decrypted."
                    },
                    "validado": {
                        "type": "boolean"
                    }
                }
            },
            "M1Episodio": {
                "type": "object",
                "description": "Episode without clinical content, with the active team.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "numero": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "area": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "area_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "avaliacao",
                            "plano",
                            "proposta",
                            "agendado",
                            "pre_operatorio",
                            "cirurgia",
                            "pos_operatorio",
                            "acompanhamento",
                            "concluido",
                            "cancelado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "etapa_jornada": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9
                    },
                    "medico_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "medico_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "aberto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "fechado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "equipa": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "utilizador_id": {
                                    "type": "integer"
                                },
                                "papel": {
                                    "type": "string"
                                },
                                "papel_rotulo": {
                                    "type": "string"
                                },
                                "nome": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                }
            },
            "M1PacienteCabecalho": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "numero": {
                        "type": "string"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "nome_completo": {
                        "type": "string"
                    },
                    "iniciais": {
                        "type": "string"
                    },
                    "sexo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "F",
                            "M",
                            "X",
                            null
                        ]
                    },
                    "sexo_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "data_nascimento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "x-anagen-permissao": "ficha.identificacao:ver"
                    },
                    "idade": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "x-anagen-permissao": "ficha.identificacao:ver"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "x-anagen-permissao": "ficha.identificacao:ver"
                    },
                    "localidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "x-anagen-permissao": "ficha.identificacao:ver"
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "ativo",
                            "arquivado",
                            "anonimizado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "portal_ativo": {
                        "type": "boolean"
                    },
                    "litigio": {
                        "type": "boolean"
                    },
                    "medico": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "responsavel": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "foto_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-anagen-permissao": "ficha.fotografias"
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "M1Ficha": {
                "type": "object",
                "properties": {
                    "paciente": {
                        "$ref": "#/components/schemas/M1PacienteCabecalho"
                    },
                    "alertas": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Alerta"
                        },
                        "description": "Active, most severe and unvalidated first; empty without clinical access."
                    },
                    "alertas_visiveis": {
                        "type": "boolean"
                    },
                    "episodios": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Episodio"
                        }
                    },
                    "episodio_ativo": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/M1Episodio"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "jornada": {
                        "type": "object",
                        "properties": {
                            "etapa": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 9
                            },
                            "episodio_id": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "seccoes": {
                                "type": "object",
                                "additionalProperties": {
                                    "type": "string"
                                },
                                "description": "Stage (1–9) → key of the section to open."
                            },
                            "etapas": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "numero": {
                                            "type": "integer"
                                        },
                                        "rotulo": {
                                            "type": "string"
                                        },
                                        "descricao": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "seccao": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    }
                                },
                                "description": "Compatible addition: the 9 stages in the request language (Contact, Pre-assessment, Consultation, Capture and plan, Quote, Pre-operative, Surgery, Post-operative, Follow-up — the server is the source) and the section each one opens."
                            }
                        }
                    },
                    "seccoes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "icone": {
                                    "type": "string"
                                },
                                "ordem": {
                                    "type": "integer"
                                },
                                "clinica": {
                                    "type": "boolean"
                                },
                                "contador": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "modulo": {
                                    "type": "string"
                                },
                                "restrita": {
                                    "type": "boolean",
                                    "description": "Compatible addition: the patient restricted this section in the portal; it only opens with emergency access («break the glass»)."
                                }
                            }
                        }
                    },
                    "acoes": {
                        "type": "object",
                        "properties": {
                            "editar": {
                                "type": "boolean"
                            },
                            "nova_consulta": {
                                "type": "boolean"
                            },
                            "resumo_ia": {
                                "type": "boolean"
                            },
                            "resumo_ia_configurado": {
                                "type": "boolean"
                            },
                            "duplicados": {
                                "type": "boolean"
                            },
                            "novo_episodio": {
                                "type": "boolean"
                            },
                            "pedir_formulario": {
                                "type": "boolean"
                            },
                            "emergencia": {
                                "type": "boolean"
                            },
                            "prescrever_url": {
                                "type": "string",
                                "description": "Certified prescription software address (doctors only; empty when not configured)."
                            }
                        }
                    }
                }
            },
            "M1SeccaoFicha": {
                "type": "object",
                "properties": {
                    "chave": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "icone": {
                        "type": "string"
                    },
                    "clinica": {
                        "type": "boolean"
                    },
                    "blocos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Bloco"
                        }
                    }
                }
            },
            "M1Duplicado": {
                "type": "object",
                "description": "Minimal identification only, with masked email and phone.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "numero": {
                        "type": "string"
                    },
                    "nome_completo": {
                        "type": "string"
                    },
                    "data_nascimento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "email": {
                        "type": "string"
                    },
                    "telefone": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string"
                    },
                    "pontuacao": {
                        "type": "integer",
                        "minimum": 40,
                        "maximum": 100
                    },
                    "forte": {
                        "type": "boolean",
                        "description": "Score ≥ 80."
                    },
                    "razoes": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "nif",
                                "email",
                                "telefone",
                                "nome_data",
                                "apelido_data"
                            ]
                        }
                    },
                    "razoes_rotulo": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "M1ComparacaoFusao": {
                "type": "object",
                "properties": {
                    "manter": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "numero": {
                                "type": "string"
                            },
                            "nome_completo": {
                                "type": "string"
                            }
                        }
                    },
                    "remover": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "numero": {
                                "type": "string"
                            },
                            "nome_completo": {
                                "type": "string"
                            }
                        }
                    },
                    "campos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "campo": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "manter": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "remover": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "igual": {
                                    "type": "boolean"
                                }
                            }
                        }
                    }
                }
            },
            "M1ResultadoFusao": {
                "type": "object",
                "properties": {
                    "manter_id": {
                        "type": "integer"
                    },
                    "remover_id": {
                        "type": "integer"
                    },
                    "campos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "reafetados": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "integer"
                        },
                        "description": "Table → reassigned rows."
                    },
                    "ignoradas": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "description": "Immutable tables that refused the change."
                    }
                }
            },
            "M1AlertasMedicacao": {
                "type": "object",
                "properties": {
                    "farmaco": {
                        "type": "string"
                    },
                    "alertas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "nivel": {
                                    "type": "string",
                                    "enum": [
                                        "alerta",
                                        "bloqueio"
                                    ]
                                },
                                "mensagem": {
                                    "type": "string"
                                },
                                "origem": {
                                    "type": "string",
                                    "enum": [
                                        "alergia",
                                        "regra"
                                    ]
                                }
                            }
                        }
                    },
                    "seguro": {
                        "type": "boolean",
                        "description": "false when there is any block."
                    }
                }
            },
            "M1Importacao": {
                "type": "object",
                "properties": {
                    "colunas": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "File header → patient field (recognised ones only)."
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "linha": {
                                    "type": "integer",
                                    "description": "Row number in the file (the first data row is 2)."
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "estado": {
                                    "type": "string",
                                    "enum": [
                                        "novo",
                                        "duplicado",
                                        "importado",
                                        "erro"
                                    ]
                                },
                                "mensagens": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "duplicado_de": {
                                    "type": [
                                        "object",
                                        "null"
                                    ],
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "numero": {
                                            "type": "string"
                                        },
                                        "nome": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "description": "Created record (only when importing): patient, consultation, alert or episode."
                                },
                                "paciente": {
                                    "type": [
                                        "object",
                                        "null"
                                    ],
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "numero": {
                                            "type": "string"
                                        }
                                    },
                                    "description": "History: the patient found (no name)."
                                }
                            }
                        }
                    },
                    "resumo": {
                        "type": "object",
                        "properties": {
                            "total": {
                                "type": "integer"
                            },
                            "novos": {
                                "type": "integer"
                            },
                            "duplicados": {
                                "type": "integer"
                            },
                            "erros": {
                                "type": "integer"
                            },
                            "importados": {
                                "type": "integer"
                            }
                        }
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "pacientes",
                            "consultas",
                            "alertas",
                            "episodios"
                        ]
                    },
                    "importacao_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Row of the «importacoes» resource (only when importing)."
                    }
                }
            },
            "M1PropostaIa": {
                "type": "object",
                "description": "Proposal from the clinic's AI assistant: proposed value and source excerpt (decrypted), explanatory factors, service and model used, request parameters, confidence and human decision (who, when, final value, reason).",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "consulta_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "resposta_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "escriba",
                            "pre_analise",
                            "resumo",
                            "rascunho_resposta",
                            "triagem"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "campo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "campo_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "valor_proposto": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "excerto_origem": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "fatores": {
                        "type": "object",
                        "description": "E.g. excerto_verificado, confianca_modelo; in pre-analysis justificacao, observacoes and fotografias; in the summary the sources."
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Service that answered (the clinic local one or the external fallback)."
                    },
                    "fornecedor_rotulo": {
                        "type": "string"
                    },
                    "modelo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Model used, recorded for traceability."
                    },
                    "parametros": {
                        "type": "object",
                        "description": "uso, temperatura, versao_pedido, caracteres or fotografias…"
                    },
                    "confianca": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 1
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pendente",
                            "aceite",
                            "corrigida",
                            "recusada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "valor_final": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "decidido_por": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Name of who decided."
                    },
                    "decidido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "lote": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Groups the proposals of the same request."
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                },
                "example": {
                    "id": 9120,
                    "paciente_id": 1204,
                    "episodio_id": 77,
                    "consulta_id": 4410,
                    "resposta_id": null,
                    "tipo": "escriba",
                    "tipo_rotulo": "Escriba",
                    "campo": "alergias",
                    "campo_rotulo": "Alergias",
                    "valor_proposto": "Alergia a penicilina (exantema).",
                    "excerto_origem": "sou alérgico à penicilina, fiquei cheio de manchas",
                    "fatores": {
                        "excerto_verificado": true,
                        "confianca_modelo": 0.92
                    },
                    "confianca": 0.92,
                    "estado": "pendente",
                    "estado_rotulo": "Pendente",
                    "valor_final": null,
                    "decidido_por": null,
                    "decidido_em": null,
                    "motivo": null,
                    "lote": "3f2a9c0d6b1e4a7f8c2d5e9b0a1f3c4d",
                    "criado_em": "2026-10-28T10:22:00+00:00"
                }
            },
            "M1Mapa": {
                "type": "object",
                "description": "Scalp map: marked zones, points with notes and the drawn line (0–1 coordinates).",
                "properties": {
                    "zonas": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "linha_frontal",
                                "tufo_central",
                                "tempora_esq",
                                "tempora_dir",
                                "frontal",
                                "media",
                                "coroa",
                                "parietal_esq",
                                "parietal_dir",
                                "occipital"
                            ]
                        }
                    },
                    "pontos": {
                        "type": "array",
                        "maxItems": 60,
                        "items": {
                            "type": "object",
                            "required": [
                                "x",
                                "y"
                            ],
                            "properties": {
                                "x": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1
                                },
                                "y": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1
                                },
                                "nota": {
                                    "type": "string",
                                    "maxLength": 120
                                }
                            }
                        }
                    },
                    "linha": {
                        "type": "array",
                        "maxItems": 200,
                        "items": {
                            "type": "object",
                            "required": [
                                "x",
                                "y"
                            ],
                            "properties": {
                                "x": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1
                                },
                                "y": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1
                                }
                            }
                        }
                    }
                },
                "example": {
                    "zonas": [
                        "linha_frontal",
                        "frontal",
                        "coroa"
                    ],
                    "pontos": [
                        {
                            "x": 0.5,
                            "y": 0.71,
                            "nota": "Miniaturização visível"
                        }
                    ],
                    "linha": [
                        {
                            "x": 0.3,
                            "y": 0.14
                        },
                        {
                            "x": 0.5,
                            "y": 0.11
                        },
                        {
                            "x": 0.7,
                            "y": 0.14
                        }
                    ]
                }
            },
            "M1Aditamento": {
                "type": "object",
                "properties": {
                    "texto": {
                        "type": "string"
                    },
                    "autor_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "autor_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "M1Consulta": {
                "type": "object",
                "description": "Decrypted consultation (clinical texts encrypted at rest).",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "paciente_id": {
                        "type": "integer"
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "marcacao_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "medico_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "medico_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "primeira",
                            "avaliacao",
                            "controlo",
                            "teleconsulta",
                            "pre_operatoria"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "rascunho",
                            "assinada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "escala": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "grau": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "basp": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "precise_pontuacao": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 100,
                        "x-unidade": "%"
                    },
                    "miniaturizacao_dadora_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 100,
                        "x-unidade": "%"
                    },
                    "area": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "sessoes_previstas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 6,
                        "x-unidade": "sessões"
                    },
                    "zonas": {
                        "$ref": "#/components/schemas/M1Mapa"
                    },
                    "escalas": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Scale → grade."
                    },
                    "elegibilidade": {
                        "type": "string",
                        "enum": [
                            "por_avaliar",
                            "apto",
                            "apto_condicional",
                            "nao_apto"
                        ]
                    },
                    "elegibilidade_rotulo": {
                        "type": "string"
                    },
                    "alertas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        },
                        "description": "Alerts from the last saved eligibility evaluation."
                    },
                    "viabilidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "viavel",
                            "condicional",
                            "nao_viavel",
                            null
                        ]
                    },
                    "viabilidade_validada_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "viabilidade_validada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "assinada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "assinada_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "impressao_digital": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[a-f0-9]{64}$"
                    },
                    "diagnostico_diferencial_itens": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "codigo": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "sistema": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "na_lista": {
                                    "type": "boolean"
                                }
                            }
                        },
                        "description": "Compatible addition: diagnoses picked from the approved support list (the PUT sends the list of keys, doctor only; outside the list → 422)."
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "«importacao» for consultations from another system (they come in closed)."
                    },
                    "aditamentos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Aditamento"
                        }
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "atualizado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "antecedentes": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "medicacao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "alergias": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "habitos": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "historia_familiar": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "expectativas": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "exame": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "diagnostico": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "diagnostico_diferencial": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                },
                "example": {
                    "id": 4410,
                    "paciente_id": 1204,
                    "episodio_id": 77,
                    "marcacao_id": 2051,
                    "medico_id": 7,
                    "medico_nome": "Inês Valente",
                    "tipo": "primeira",
                    "tipo_rotulo": "Primeira consulta",
                    "data": "2026-10-28T10:00:00+00:00",
                    "estado": "rascunho",
                    "estado_rotulo": "Rascunho",
                    "escala": "norwood",
                    "grau": "IV",
                    "basp": null,
                    "precise_pontuacao": 62.5,
                    "miniaturizacao_dadora_pct": 12,
                    "area": "couro_cabeludo",
                    "tecnica": "FUE",
                    "sessoes_previstas": 1,
                    "zonas": {
                        "zonas": [
                            "linha_frontal",
                            "frontal",
                            "coroa"
                        ],
                        "pontos": [
                            {
                                "x": 0.5,
                                "y": 0.71,
                                "nota": "Miniaturização visível"
                            }
                        ],
                        "linha": [
                            {
                                "x": 0.3,
                                "y": 0.14
                            },
                            {
                                "x": 0.5,
                                "y": 0.11
                            },
                            {
                                "x": 0.7,
                                "y": 0.14
                            }
                        ]
                    },
                    "escalas": {
                        "norwood": "IV"
                    },
                    "elegibilidade": "apto_condicional",
                    "elegibilidade_rotulo": "Apto com condições",
                    "alertas": [
                        {
                            "regra_id": 12,
                            "nome": "Anticoagulante",
                            "nivel": "alerta",
                            "mensagem": "Confirmar a suspensão com o médico assistente.",
                            "origem": "regra"
                        }
                    ],
                    "viabilidade": null,
                    "viabilidade_validada_por": null,
                    "viabilidade_validada_em": null,
                    "assinada_em": null,
                    "assinada_por": null,
                    "impressao_digital": null,
                    "aditamentos": [],
                    "criado_em": "2026-10-28T09:58:00+00:00",
                    "atualizado_em": "2026-10-28T10:21:00+00:00",
                    "motivo": "Queda progressiva na zona frontal desde há 5 anos.",
                    "antecedentes": "Sem antecedentes relevantes.",
                    "medicacao": "Apixabano 5 mg.",
                    "alergias": "Penicilina.",
                    "habitos": "Não fumador.",
                    "historia_familiar": "Pai com alopecia androgenética.",
                    "expectativas": "Recuperar a linha frontal.",
                    "exame": "Rarefação frontal e na coroa; zona dadora com boa densidade.",
                    "diagnostico": "Alopecia androgenética, Norwood IV.",
                    "diagnostico_diferencial": null,
                    "notas": null
                }
            },
            "M1ConsultaEntrada": {
                "type": "object",
                "description": "Fields accepted by PUT /consultas/{id} (others are ignored). Doctor-only fields: diagnostico, diagnostico_diferencial, escala, grau, basp, precise_pontuacao, escalas, zonas, area, tecnica, sessoes_previstas.",
                "properties": {
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20000
                    },
                    "antecedentes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20000
                    },
                    "medicacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20000
                    },
                    "alergias": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20000
                    },
                    "habitos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20000
                    },
                    "historia_familiar": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20000
                    },
                    "expectativas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20000
                    },
                    "exame": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20000
                    },
                    "diagnostico": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20000
                    },
                    "diagnostico_diferencial": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20000
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20000
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "primeira",
                            "avaliacao",
                            "controlo",
                            "teleconsulta",
                            "pre_operatoria"
                        ]
                    },
                    "data": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "escala": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "norwood",
                            "ludwig",
                            "savin",
                            "sinclair",
                            "basp",
                            "outra",
                            null
                        ]
                    },
                    "grau": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 20,
                        "description": "Must exist in the scale (see GET /clinica/catalogo), except with the «outra» scale."
                    },
                    "basp": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^(L|M[0-3]|C[0-3]|U[1-3])(F[1-3])?(V[1-3])?$"
                    },
                    "precise_pontuacao": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 100,
                        "x-unidade": "%"
                    },
                    "miniaturizacao_dadora_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 100,
                        "x-unidade": "%"
                    },
                    "area": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "couro_cabeludo",
                            "barba",
                            "sobrancelhas",
                            "feminina",
                            "reparacao",
                            "outra",
                            null
                        ]
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra",
                            null
                        ]
                    },
                    "sessoes_previstas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 6
                    },
                    "zonas": {
                        "$ref": "#/components/schemas/M1Mapa"
                    },
                    "escalas": {
                        "type": "object",
                        "properties": {
                            "norwood": {
                                "type": "string"
                            },
                            "ludwig": {
                                "type": "string"
                            },
                            "savin": {
                                "type": "string"
                            },
                            "sinclair": {
                                "type": "string"
                            }
                        },
                        "description": "Scale → grade; pairs with an invalid scale or grade are dropped."
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    }
                }
            },
            "M1Elegibilidade": {
                "type": "object",
                "properties": {
                    "estado": {
                        "type": "string",
                        "enum": [
                            "por_avaliar",
                            "apto",
                            "apto_condicional",
                            "nao_apto"
                        ]
                    },
                    "alertas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "regra_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "nivel": {
                                    "type": "string",
                                    "enum": [
                                        "alerta",
                                        "bloqueio"
                                    ]
                                },
                                "mensagem": {
                                    "type": "string"
                                },
                                "origem": {
                                    "type": "string",
                                    "enum": [
                                        "regra",
                                        "motor",
                                        "sistema"
                                    ]
                                }
                            }
                        }
                    },
                    "regras_aprovadas": {
                        "type": "integer"
                    },
                    "motor": {
                        "type": "boolean",
                        "description": "Limits from an approved engine version apply."
                    }
                },
                "example": {
                    "estado": "apto_condicional",
                    "alertas": [
                        {
                            "regra_id": 12,
                            "nome": "Anticoagulante",
                            "nivel": "alerta",
                            "mensagem": "Confirmar a suspensão com o médico assistente.",
                            "origem": "regra"
                        }
                    ],
                    "regras_aprovadas": 9,
                    "motor": true
                }
            },
            "M1PacoteConsulta": {
                "type": "object",
                "properties": {
                    "consulta": {
                        "$ref": "#/components/schemas/M1Consulta"
                    },
                    "paciente": {
                        "$ref": "#/components/schemas/M1PacienteMinimo"
                    },
                    "episodio": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/M1Episodio"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "alertas": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Alerta"
                        }
                    },
                    "elegibilidade": {
                        "$ref": "#/components/schemas/M1Elegibilidade"
                    },
                    "tabela_clinica": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "zona": {
                                    "type": "string"
                                },
                                "min": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "x-unidade": "enxertos"
                                },
                                "max": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "x-unidade": "enxertos"
                                }
                            }
                        },
                        "description": "Graft range from the approved clinical table for the consultation zones and grade."
                    },
                    "propostas": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1PropostaIa"
                        },
                        "description": "Pending proposals of this consultation."
                    },
                    "anteriores": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "data": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "tipo": {
                                    "type": "string"
                                },
                                "tipo_rotulo": {
                                    "type": "string"
                                },
                                "estado": {
                                    "type": "string"
                                },
                                "estado_rotulo": {
                                    "type": "string"
                                },
                                "medico_nome": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "escala": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "grau": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "elegibilidade": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "questionario": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "estado": {
                                "type": "string"
                            },
                            "estado_rotulo": {
                                "type": "string"
                            },
                            "preenchido_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "itens": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "rotulo": {
                                            "type": "string"
                                        },
                                        "texto": {
                                            "type": "string"
                                        },
                                        "alarme": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "permissoes": {
                        "type": "object",
                        "properties": {
                            "editar": {
                                "type": "boolean"
                            },
                            "editar_medico": {
                                "type": "boolean"
                            },
                            "assinar": {
                                "type": "boolean"
                            },
                            "aditar": {
                                "type": "boolean"
                            },
                            "viabilidade": {
                                "type": "boolean"
                            },
                            "escriba": {
                                "type": "boolean"
                            },
                            "pre_analise": {
                                "type": "boolean"
                            },
                            "resumo": {
                                "type": "boolean"
                            }
                        }
                    },
                    "ia": {
                        "type": "object",
                        "properties": {
                            "escriba": {
                                "type": "boolean"
                            },
                            "pre_analise": {
                                "type": "boolean"
                            },
                            "resumo": {
                                "type": "boolean"
                            },
                            "consentimento": {
                                "type": "boolean"
                            }
                        },
                        "description": "Configured assistant uses and the patient «ia» consent — so the screen shows when it is unavailable."
                    },
                    "prescricao": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "url": {
                                "type": "string",
                                "format": "uri"
                            },
                            "nome": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "M1CatalogoConsulta": {
                "type": "object",
                "properties": {
                    "diagnosticos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "codigo": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "sistema": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "descricao": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        },
                        "description": "Compatible addition: differential diagnosis support list approved by the clinical director (diagnosticos_apoio resource)."
                    },
                    "caixa": {
                        "type": "object",
                        "properties": {
                            "largura": {
                                "const": 100
                            },
                            "altura": {
                                "const": 120
                            }
                        }
                    },
                    "zonas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string",
                                    "enum": [
                                        "linha_frontal",
                                        "tufo_central",
                                        "tempora_esq",
                                        "tempora_dir",
                                        "frontal",
                                        "media",
                                        "coroa",
                                        "parietal_esq",
                                        "parietal_dir",
                                        "occipital"
                                    ]
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "grupo": {
                                    "type": "string",
                                    "enum": [
                                        "recetora",
                                        "dadora"
                                    ]
                                },
                                "pontos": {
                                    "type": "array",
                                    "items": {
                                        "type": "array",
                                        "items": {
                                            "type": "number"
                                        },
                                        "minItems": 2,
                                        "maxItems": 2
                                    }
                                }
                            }
                        }
                    },
                    "escalas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "sexo": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "graus": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "valor": {
                                                "type": "string"
                                            },
                                            "rotulo": {
                                                "type": "string"
                                            },
                                            "descricao": {
                                                "type": "string"
                                            },
                                            "perda": {
                                                "type": "object",
                                                "additionalProperties": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                },
                                                "description": "Zone → loss (0–1)."
                                            }
                                        }
                                    }
                                },
                                "basicos": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                },
                                "especificos": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    },
                    "tipos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Opcao"
                        }
                    },
                    "areas": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Opcao"
                        }
                    },
                    "tecnicas": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Opcao"
                        }
                    },
                    "viabilidades": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Opcao"
                        }
                    },
                    "elegibilidades": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Opcao"
                        }
                    },
                    "papeis": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Opcao"
                        }
                    },
                    "campos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "campo": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "ajuda": {
                                    "type": "string"
                                },
                                "medico": {
                                    "type": "boolean",
                                    "description": "Doctor-only."
                                }
                            }
                        }
                    },
                    "seccoes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string",
                                    "enum": [
                                        "anamnese",
                                        "exame",
                                        "mapa",
                                        "diagnostico"
                                    ]
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "campos": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "M1Opcao": {
                "type": "object",
                "properties": {
                    "valor": {
                        "type": "string"
                    },
                    "rotulo": {
                        "type": "string"
                    }
                }
            },
            "M1Completude": {
                "type": "object",
                "properties": {
                    "itens": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string",
                                    "enum": [
                                        "consulta_assinada",
                                        "notas",
                                        "viabilidade",
                                        "questionario",
                                        "alertas",
                                        "fotografias",
                                        "plano",
                                        "consentimento",
                                        "proposta",
                                        "sinal"
                                    ]
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "estado": {
                                    "type": "string",
                                    "enum": [
                                        "ok",
                                        "falta",
                                        "indisponivel"
                                    ]
                                },
                                "estado_rotulo": {
                                    "type": "string"
                                },
                                "detalhe": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "ligacao": {
                                    "$ref": "#/components/schemas/M1Ligacao"
                                }
                            }
                        }
                    },
                    "pronto": {
                        "type": "boolean"
                    },
                    "em_falta": {
                        "type": "integer"
                    }
                }
            },
            "M1ContadoresValidacao": {
                "type": "object",
                "properties": {
                    "proposta": {
                        "type": "integer"
                    },
                    "resposta": {
                        "type": "integer"
                    },
                    "pre_avaliacao": {
                        "type": "integer"
                    },
                    "alerta": {
                        "type": "integer"
                    },
                    "consulta": {
                        "type": "integer"
                    },
                    "total": {
                        "type": "integer"
                    }
                }
            },
            "M1ItemValidacao": {
                "type": "object",
                "properties": {
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "proposta",
                            "resposta",
                            "pre_avaliacao",
                            "alerta",
                            "consulta"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "id": {
                        "type": "integer"
                    },
                    "chave": {
                        "type": "string",
                        "description": "«type:id»."
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "paciente_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "paciente_numero": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "subtitulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "urgente": {
                        "type": "boolean"
                    },
                    "extra": {
                        "type": "object",
                        "description": "proposal: tipo_proposta, consulta_id; response/pre-assessment: fotos, devolvida; alert: gravidade; consultation: elegibilidade."
                    }
                }
            },
            "M1DetalheValidacao": {
                "type": "object",
                "description": "Depending on the type, carries «proposta», «resposta» (with lead_id), «alerta» or «consulta» (with «permissoes»).",
                "properties": {
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "proposta",
                            "resposta",
                            "pre_avaliacao",
                            "alerta",
                            "consulta"
                        ]
                    },
                    "id": {
                        "type": "integer"
                    },
                    "paciente": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/M1PacienteMinimo"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "proposta": {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/M1PropostaIa"
                            },
                            {
                                "type": "object",
                                "properties": {
                                    "pode_decidir": {
                                        "type": "boolean"
                                    }
                                }
                            }
                        ]
                    },
                    "resposta": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "formulario_id": {
                                "type": "integer"
                            },
                            "formulario_nome": {
                                "type": "string"
                            },
                            "formulario_tipo": {
                                "type": "string"
                            },
                            "versao": {
                                "type": "integer"
                            },
                            "origem": {
                                "type": "string",
                                "enum": [
                                    "paciente",
                                    "equipa",
                                    "agente",
                                    "site"
                                ]
                            },
                            "origem_rotulo": {
                                "type": "string"
                            },
                            "estado": {
                                "type": "string",
                                "enum": [
                                    "pendente",
                                    "por_validar",
                                    "validado",
                                    "rejeitado",
                                    "expirado"
                                ]
                            },
                            "pontuacao": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "faixa": {
                                "type": [
                                    "object",
                                    "null"
                                ],
                                "properties": {
                                    "rotulo": {
                                        "type": "string"
                                    },
                                    "tom": {
                                        "type": "string"
                                    }
                                }
                            },
                            "alarme": {
                                "type": "boolean"
                            },
                            "preenchido_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "devolvido_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "devolucao_motivo": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "itens": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/M1ItemResposta"
                                }
                            },
                            "fotos": {
                                "type": "array",
                                "items": {
                                    "type": "integer"
                                },
                                "description": "File identifiers (response and website pre-assessment)."
                            },
                            "triagem": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/M1PropostaIa"
                                }
                            }
                        }
                    },
                    "alerta": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "tipo": {
                                "type": "string",
                                "enum": [
                                    "alergia",
                                    "medicacao",
                                    "condicao",
                                    "anticoagulante",
                                    "outro"
                                ]
                            },
                            "tipo_rotulo": {
                                "type": "string"
                            },
                            "gravidade": {
                                "type": "string",
                                "enum": [
                                    "baixa",
                                    "media",
                                    "alta"
                                ]
                            },
                            "gravidade_rotulo": {
                                "type": "string"
                            },
                            "descricao": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "origem": {
                                "type": "string",
                                "enum": [
                                    "equipa",
                                    "paciente",
                                    "agente",
                                    "formulario",
                                    "importacao"
                                ]
                            },
                            "origem_rotulo": {
                                "type": "string"
                            },
                            "criado_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            }
                        }
                    },
                    "consulta": {
                        "$ref": "#/components/schemas/M1Consulta"
                    },
                    "permissoes": {
                        "type": "object"
                    },
                    "pode_decidir": {
                        "type": "boolean"
                    }
                }
            },
            "M1DesempenhoIa": {
                "type": "object",
                "properties": {
                    "de": {
                        "type": "string",
                        "format": "date"
                    },
                    "ate": {
                        "type": "string",
                        "format": "date"
                    },
                    "totais": {
                        "type": "object",
                        "properties": {
                            "pendente": {
                                "type": "integer"
                            },
                            "aceite": {
                                "type": "integer"
                            },
                            "corrigida": {
                                "type": "integer"
                            },
                            "recusada": {
                                "type": "integer"
                            },
                            "decididas": {
                                "type": "integer"
                            },
                            "concordancia": {
                                "type": [
                                    "number",
                                    "null"
                                ],
                                "minimum": 0,
                                "maximum": 100,
                                "x-unidade": "%"
                            }
                        }
                    },
                    "por_tipo": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1AgregadoDesempenho"
                        }
                    },
                    "por_modelo": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1AgregadoDesempenho"
                        }
                    },
                    "serie": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string",
                                    "description": "ISO week «YYYY-WW»."
                                },
                                "y": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "minimum": 0,
                                    "maximum": 100,
                                    "x-unidade": "%"
                                },
                                "serie": {
                                    "type": "string"
                                }
                            }
                        },
                        "description": "Weekly agreement (only weeks with decisions)."
                    }
                }
            },
            "M1AgregadoDesempenho": {
                "type": "object",
                "properties": {
                    "chave": {
                        "type": "string"
                    },
                    "rotulo": {
                        "type": "string"
                    },
                    "pendente": {
                        "type": "integer"
                    },
                    "aceite": {
                        "type": "integer"
                    },
                    "corrigida": {
                        "type": "integer"
                    },
                    "recusada": {
                        "type": "integer"
                    },
                    "decididas": {
                        "type": "integer"
                    },
                    "total": {
                        "type": "integer"
                    },
                    "concordancia": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": 0,
                        "maximum": 100,
                        "x-unidade": "%"
                    }
                }
            },
            "M1Formulario": {
                "type": "object",
                "description": "Form summary (without the schema).",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "chave": {
                        "type": "string"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "anamnese",
                            "questionario_previo",
                            "seguimento",
                            "satisfacao",
                            "pre_avaliacao",
                            "tecnica",
                            "triagem_sintomas",
                            "outro"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "idioma": {
                        "type": "string",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ]
                    },
                    "ativo": {
                        "type": "boolean"
                    },
                    "modelo": {
                        "type": "boolean"
                    },
                    "expira_dias": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "publicado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                },
                "example": {
                    "id": 31,
                    "chave": "questionario_previo_fue",
                    "nome": "Questionário prévio — FUE",
                    "descricao": "A preencher antes da primeira consulta.",
                    "tipo": "questionario_previo",
                    "tipo_rotulo": "Questionário prévio",
                    "tecnica": "FUE",
                    "versao": 3,
                    "idioma": "pt-PT",
                    "ativo": true,
                    "modelo": false,
                    "expira_dias": 14,
                    "publicado_em": "2026-10-20T15:40:00+01:00"
                }
            },
            "M1Pergunta": {
                "type": "object",
                "required": [
                    "chave",
                    "tipo",
                    "rotulo"
                ],
                "description": "Schema question. Properties per type: escolha/multipla → opcoes (1–60); escala → min, max (range up to 100), passo, rotulo_min, rotulo_max, pontuar, alarme_min; numero → unidade, casas (0–3), min, max, pontuar, alarme_min, alarme_max; simnao → pontos_sim, alarme_sim; grelha → linhas (up to 30) and colunas (up to 12); fotografia → vistas (up to 12), max_fotos (1–12); texto/textoLongo → max (up to 500 / 8000). condicao shows the question only when another one meets the rule; alerta creates a clinical alert when the answer is in «quando» (empty = any answer other than «nao»).",
                "properties": {
                    "chave": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,39}$"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "texto",
                            "textoLongo",
                            "escolha",
                            "multipla",
                            "escala",
                            "simnao",
                            "data",
                            "numero",
                            "grelha",
                            "fotografia",
                            "assinatura",
                            "info"
                        ]
                    },
                    "rotulo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 300
                    },
                    "ajuda": {
                        "type": "string",
                        "maxLength": 500
                    },
                    "obrigatorio": {
                        "type": "boolean"
                    },
                    "preencher": {
                        "type": "boolean",
                        "default": true,
                        "description": "Pre-fill with the previous answer."
                    },
                    "opcoes": {
                        "type": "array",
                        "maxItems": 60,
                        "items": {
                            "type": "object",
                            "properties": {
                                "valor": {
                                    "type": "string",
                                    "pattern": "^[a-z0-9][a-z0-9_\\-]{0,39}$"
                                },
                                "rotulo": {
                                    "type": "string",
                                    "maxLength": 200
                                },
                                "pontos": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "alarme": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "min": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "max": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "passo": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "rotulo_min": {
                        "type": "string",
                        "maxLength": 60
                    },
                    "rotulo_max": {
                        "type": "string",
                        "maxLength": 60
                    },
                    "pontuar": {
                        "type": "boolean"
                    },
                    "alarme_min": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "alarme_max": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "unidade": {
                        "type": "string",
                        "maxLength": 20
                    },
                    "casas": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 3
                    },
                    "pontos_sim": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "alarme_sim": {
                        "type": "boolean"
                    },
                    "linhas": {
                        "type": "array",
                        "maxItems": 30,
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,39}$"
                                },
                                "rotulo": {
                                    "type": "string",
                                    "maxLength": 200
                                }
                            }
                        }
                    },
                    "colunas": {
                        "type": "array",
                        "maxItems": 12,
                        "items": {
                            "type": "object",
                            "properties": {
                                "valor": {
                                    "type": "string",
                                    "pattern": "^[a-z0-9][a-z0-9_\\-]{0,39}$"
                                },
                                "rotulo": {
                                    "type": "string",
                                    "maxLength": 80
                                },
                                "pontos": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "vistas": {
                        "type": "array",
                        "maxItems": 12,
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,39}$"
                                },
                                "rotulo": {
                                    "type": "string",
                                    "maxLength": 120
                                },
                                "instrucoes": {
                                    "type": "string",
                                    "maxLength": 300
                                }
                            }
                        }
                    },
                    "max_fotos": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                    },
                    "condicao": {
                        "type": "object",
                        "properties": {
                            "pergunta": {
                                "type": "string"
                            },
                            "operador": {
                                "type": "string",
                                "enum": [
                                    "=",
                                    "!=",
                                    ">",
                                    "<",
                                    "contem",
                                    "respondida"
                                ]
                            },
                            "valor": {
                                "type": "string",
                                "maxLength": 120
                            }
                        }
                    },
                    "alerta": {
                        "type": "object",
                        "properties": {
                            "tipo": {
                                "type": "string",
                                "enum": [
                                    "alergia",
                                    "medicacao",
                                    "condicao",
                                    "anticoagulante",
                                    "outro"
                                ]
                            },
                            "gravidade": {
                                "type": "string",
                                "enum": [
                                    "baixa",
                                    "media",
                                    "alta"
                                ],
                                "default": "media"
                            },
                            "quando": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "M1EsquemaFormulario": {
                "type": "object",
                "required": [
                    "passos"
                ],
                "properties": {
                    "passos": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 20,
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "titulo": {
                                    "type": "string",
                                    "maxLength": 200
                                },
                                "descricao": {
                                    "type": "string",
                                    "maxLength": 1000
                                },
                                "seccoes": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "chave": {
                                                "type": "string"
                                            },
                                            "titulo": {
                                                "type": "string",
                                                "maxLength": 200
                                            },
                                            "descricao": {
                                                "type": "string",
                                                "maxLength": 1000
                                            },
                                            "perguntas": {
                                                "type": "array",
                                                "items": {
                                                    "$ref": "#/components/schemas/M1Pergunta"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "pontuacao": {
                        "type": "object",
                        "properties": {
                            "ativa": {
                                "type": "boolean"
                            },
                            "rotulo": {
                                "type": "string",
                                "maxLength": 80
                            },
                            "modo": {
                                "type": "string",
                                "enum": [
                                    "soma",
                                    "media",
                                    "pergunta"
                                ],
                                "default": "soma"
                            },
                            "pergunta": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Key of the question giving the score («pergunta» mode)."
                            },
                            "faixas": {
                                "type": "array",
                                "maxItems": 10,
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "min": {
                                            "type": [
                                                "number",
                                                "null"
                                            ]
                                        },
                                        "max": {
                                            "type": [
                                                "number",
                                                "null"
                                            ]
                                        },
                                        "rotulo": {
                                            "type": "string",
                                            "maxLength": 80
                                        },
                                        "tom": {
                                            "type": "string",
                                            "enum": [
                                                "marca",
                                                "ouro",
                                                "sucesso",
                                                "aviso",
                                                "perigo",
                                                "info",
                                                "neutro"
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "alarmes": {
                        "type": "object",
                        "properties": {
                            "departamento": {
                                "type": "string",
                                "enum": [
                                    "medico",
                                    "enfermagem",
                                    "tecnico",
                                    "comercial",
                                    "rececao",
                                    "administracao"
                                ],
                                "default": "enfermagem"
                            }
                        }
                    }
                },
                "example": {
                    "passos": [
                        {
                            "chave": "p1",
                            "titulo": "Saúde geral",
                            "descricao": "",
                            "seccoes": [
                                {
                                    "chave": "s1_1",
                                    "titulo": "Antecedentes",
                                    "descricao": "",
                                    "perguntas": [
                                        {
                                            "chave": "anticoagulantes",
                                            "tipo": "simnao",
                                            "rotulo": "Toma anticoagulantes?",
                                            "ajuda": "",
                                            "obrigatorio": true,
                                            "preencher": true,
                                            "pontos_sim": null,
                                            "alarme_sim": true,
                                            "alerta": {
                                                "tipo": "anticoagulante",
                                                "gravidade": "alta",
                                                "quando": [
                                                    "sim"
                                                ]
                                            }
                                        },
                                        {
                                            "chave": "qual_anticoagulante",
                                            "tipo": "texto",
                                            "rotulo": "Qual?",
                                            "ajuda": "",
                                            "obrigatorio": false,
                                            "preencher": true,
                                            "max": 200,
                                            "condicao": {
                                                "pergunta": "anticoagulantes",
                                                "operador": "=",
                                                "valor": "sim"
                                            }
                                        },
                                        {
                                            "chave": "impacto",
                                            "tipo": "escala",
                                            "rotulo": "Quanto o incomoda a queda de cabelo?",
                                            "ajuda": "",
                                            "obrigatorio": true,
                                            "preencher": false,
                                            "min": 0,
                                            "max": 10,
                                            "passo": 1,
                                            "rotulo_min": "Nada",
                                            "rotulo_max": "Muito",
                                            "pontuar": true,
                                            "alarme_min": null
                                        }
                                    ]
                                }
                            ]
                        }
                    ],
                    "pontuacao": {
                        "ativa": true,
                        "rotulo": "Impacto",
                        "modo": "soma",
                        "pergunta": null,
                        "faixas": [
                            {
                                "min": 0,
                                "max": 4,
                                "rotulo": "Baixo",
                                "tom": "sucesso"
                            },
                            {
                                "min": 5,
                                "max": 10,
                                "rotulo": "Elevado",
                                "tom": "aviso"
                            }
                        ]
                    },
                    "alarmes": {
                        "departamento": "enfermagem"
                    }
                }
            },
            "M1EditorFormulario": {
                "type": "object",
                "properties": {
                    "formulario": {
                        "$ref": "#/components/schemas/M1Formulario"
                    },
                    "esquema": {
                        "$ref": "#/components/schemas/M1EsquemaFormulario"
                    },
                    "tipos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "tipo": {
                                    "type": "string",
                                    "enum": [
                                        "texto",
                                        "textoLongo",
                                        "escolha",
                                        "multipla",
                                        "escala",
                                        "simnao",
                                        "data",
                                        "numero",
                                        "grelha",
                                        "fotografia",
                                        "assinatura",
                                        "info"
                                    ]
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "icone": {
                                    "type": "string"
                                },
                                "descricao": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "versoes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "versao": {
                                    "type": "integer"
                                },
                                "publicado_em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "publicado_por": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "traducoes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "idioma": {
                                    "type": "string",
                                    "enum": [
                                        "pt-PT",
                                        "pt-BR",
                                        "en",
                                        "es",
                                        "fr",
                                        "de"
                                    ]
                                },
                                "ativo": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "respostas": {
                        "type": "integer",
                        "description": "Responses received (excluding pending and expired)."
                    },
                    "editavel": {
                        "type": "boolean"
                    },
                    "ia_traducao": {
                        "type": "boolean",
                        "description": "Translation by the clinic's AI assistant configured."
                    }
                }
            },
            "M1ItemResposta": {
                "type": "object",
                "properties": {
                    "chave": {
                        "type": "string"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "texto",
                            "textoLongo",
                            "escolha",
                            "multipla",
                            "escala",
                            "simnao",
                            "data",
                            "numero",
                            "grelha",
                            "fotografia",
                            "assinatura",
                            "info"
                        ]
                    },
                    "seccao": {
                        "type": "string"
                    },
                    "rotulo": {
                        "type": "string"
                    },
                    "valor": {
                        "description": "Stored value (type per question)."
                    },
                    "texto": {
                        "type": "string",
                        "description": "Readable value."
                    },
                    "alarme": {
                        "type": "boolean"
                    }
                }
            },
            "M1ResultadoResposta": {
                "type": "object",
                "properties": {
                    "resposta_id": {
                        "type": "integer"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "validado",
                            "por_validar"
                        ]
                    },
                    "pontuacao": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "faixa": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "rotulo": {
                                "type": "string"
                            },
                            "tom": {
                                "type": "string",
                                "enum": [
                                    "marca",
                                    "ouro",
                                    "sucesso",
                                    "aviso",
                                    "perigo",
                                    "info",
                                    "neutro"
                                ]
                            }
                        }
                    },
                    "alarme": {
                        "type": "boolean"
                    }
                }
            },
            "M1RespostaFormulario": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "formulario": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/M1Formulario"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "esquema": {
                        "$ref": "#/components/schemas/M1EsquemaFormulario"
                    },
                    "respostas": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Question key → value (decrypted)."
                    },
                    "itens": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1ItemResposta"
                        }
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "origem": {
                        "type": "string",
                        "enum": [
                            "paciente",
                            "equipa",
                            "agente",
                            "site"
                        ]
                    },
                    "origem_rotulo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pendente",
                            "por_validar",
                            "validado",
                            "rejeitado",
                            "expirado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "pontuacao": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "faixa": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "rotulo": {
                                "type": "string"
                            },
                            "tom": {
                                "type": "string"
                            }
                        }
                    },
                    "alarme": {
                        "type": "boolean"
                    },
                    "preenchido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "validado_por": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Name of who validated."
                    },
                    "validado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "devolucao_motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pode_validar": {
                        "type": "boolean"
                    }
                }
            },
            "M1Envio": {
                "type": "object",
                "description": "Service message sending result (a missing contact does not fail the request: ok = false).",
                "properties": {
                    "ok": {
                        "type": "boolean"
                    },
                    "estado": {
                        "type": "string"
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mensagem_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    }
                }
            },
            "M1PedidoFormulario": {
                "type": "object",
                "properties": {
                    "resposta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Created request (POST /formularios/{id}/pedidos)."
                    },
                    "id": {
                        "type": "integer",
                        "description": "Returned response (POST /validacoes/respostas/{id}/devolver)."
                    },
                    "ligacao": {
                        "type": "string",
                        "format": "uri"
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "Link deadline in ISO 8601 (with the clinic time zone)."
                    },
                    "envio": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/M1Envio"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                }
            },
            "M1Consentimento": {
                "type": "object",
                "description": "Missing authorisation to collect these answers: «tratamento_clinico» always and «fotografias_clinicas» when the form has photo questions — only those without a valid «dado» decision yet. The screen shows one box per item, NEVER pre-ticked, and sends {finalidade: true} in «consentimentos». Without a patient or lead the list is empty.",
                "properties": {
                    "finalidade": {
                        "type": "string",
                        "enum": [
                            "tratamento_clinico",
                            "fotografias_clinicas"
                        ]
                    },
                    "texto": {
                        "type": "string",
                        "description": "Text of the clinic approved template in that language (summarised to 600 characters) or the default text."
                    },
                    "modelo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Approved consent template used (recorded with the decision)."
                    }
                }
            },
            "M1AvisoPrivacidade": {
                "type": "object",
                "description": "Privacy notice in force for the «formulario» channel (the compliance single per-channel notice service). Show it before collecting data and return «testemunho» in «aviso_testemunho» on submit: the server records the version shown, to whom and when.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "canal": {
                        "type": "string"
                    },
                    "canal_rotulo": {
                        "type": "string"
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "texto": {
                        "type": "string",
                        "description": "Sanitised HTML."
                    },
                    "idioma": {
                        "type": "string"
                    },
                    "publicado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "contexto": {
                        "type": "string"
                    },
                    "testemunho": {
                        "type": "string",
                        "description": "Signed token of the version shown (valid for 24 h)."
                    }
                }
            },
            "M1FormularioPublico": {
                "type": "object",
                "properties": {
                    "formulario": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "descricao": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "idioma": {
                                "type": "string",
                                "enum": [
                                    "pt-PT",
                                    "pt-BR",
                                    "en",
                                    "es",
                                    "fr",
                                    "de"
                                ]
                            },
                            "tipo": {
                                "type": "string",
                                "enum": [
                                    "anamnese",
                                    "questionario_previo",
                                    "seguimento",
                                    "satisfacao",
                                    "pre_avaliacao",
                                    "tecnica",
                                    "triagem_sintomas",
                                    "outro"
                                ]
                            }
                        }
                    },
                    "esquema": {
                        "$ref": "#/components/schemas/M1EsquemaFormulario"
                    },
                    "valores": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Pre-fill: question key → value."
                    },
                    "consentimentos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M1Consentimento"
                        },
                        "description": "Compatible addition: missing authorisations (boxes to tick before submitting)."
                    },
                    "aviso": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/M1AvisoPrivacidade"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Compatible addition: notice in force for the «formulario» channel; null when the clinic has not published one."
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "devolucao_motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Clinic information request when the response was returned."
                    },
                    "clinica": {
                        "type": "string",
                        "description": "Clinic name."
                    },
                    "armadilha": {
                        "type": "string",
                        "description": "Compatible addition: trap field name, which must be sent empty."
                    }
                }
            },
            "M5Calculo": {
                "type": "object",
                "properties": {
                    "base": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "extras": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "desconto": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "iva_valor": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "total": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "moeda": {
                        "type": "string"
                    },
                    "total_moeda": {
                        "type": "number"
                    },
                    "preco_medio_enxerto": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "passos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "M5Opcao": {
                "type": "object",
                "properties": {
                    "chave": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "titulo_en": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "enxertos": {
                        "type": "integer"
                    },
                    "sessoes": {
                        "type": "integer"
                    },
                    "quantidade": {
                        "type": "number"
                    },
                    "recomendada": {
                        "type": "boolean"
                    },
                    "calculo": {
                        "$ref": "#/components/schemas/M5Calculo"
                    },
                    "total_moeda": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "custos": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Only with financeiro.valores (all)."
                    }
                }
            },
            "M5Proposta": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "numero": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "rascunho",
                            "enviada",
                            "vista",
                            "aceite",
                            "recusada",
                            "expirada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "idioma": {
                        "type": "string"
                    },
                    "moeda": {
                        "type": "string"
                    },
                    "cambio": {
                        "type": "number"
                    },
                    "cambio_fixado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "pessoa": {
                        "type": "object",
                        "properties": {
                            "tipo": {
                                "type": "string"
                            },
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            }
                        }
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "plano_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "plano_versao": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "parametros_versao": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "procedimento": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "tabela": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "responsavel": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "opcoes": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M5Opcao"
                        }
                    },
                    "opcao_principal": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "opcao_aceite": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "extras_disponiveis": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "subtotal": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "desconto_pct": {
                        "type": "number"
                    },
                    "desconto_valor": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "desconto_estado": {
                        "type": "string",
                        "enum": [
                            "nao_aplicavel",
                            "pendente",
                            "aprovado",
                            "recusado"
                        ]
                    },
                    "desconto_estado_rotulo": {
                        "type": "string"
                    },
                    "desconto_motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "limite_desconto": {
                        "type": "number"
                    },
                    "iva_valor": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "total": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "total_moeda": {
                        "type": "number"
                    },
                    "prestacoes": {
                        "type": "object",
                        "properties": {
                            "escolhida": {
                                "type": "integer"
                            },
                            "sinal": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "simulacao": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "condicoes": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "validade_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "dias_validade": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "enviada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "vista_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "vista_contagem": {
                        "type": "integer"
                    },
                    "aceite_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "aceite_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "recusada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "motivo_recusa": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "selada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "impressao_digital": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "impressao_legivel": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "plano": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "ligacao_publica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pdf": {
                        "type": "object",
                        "properties": {
                            "pt": {
                                "type": "string"
                            },
                            "en": {
                                "type": "string"
                            }
                        }
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "historico": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "acoes": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "boolean"
                        }
                    },
                    "moedas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "prestacoes_opcoes": {
                        "type": "array",
                        "items": {
                            "type": "integer"
                        }
                    },
                    "margem": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR",
                        "description": "Only with financeiro.valores (all)."
                    },
                    "custos_internos": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "pagamentos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M5Pagamento"
                        }
                    }
                }
            },
            "M5ResumoPropostas": {
                "type": "object",
                "properties": {
                    "kpis": {
                        "type": "object",
                        "properties": {
                            "rascunhos": {
                                "type": "integer"
                            },
                            "em_aberto": {
                                "type": "integer"
                            },
                            "valor_em_aberto": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "vistas": {
                                "type": "integer"
                            },
                            "aceites_mes": {
                                "type": "integer"
                            },
                            "taxa_aceitacao_90d": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "paradas": {
                                "type": "integer"
                            },
                            "descontos_pendentes": {
                                "type": "integer"
                            }
                        }
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "grafico": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "number"
                                },
                                "serie": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "funil": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "number"
                                }
                            }
                        }
                    },
                    "pode": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "boolean"
                        }
                    }
                }
            },
            "M5PropostaPublica": {
                "type": "object",
                "description": "Patient view: no internal costs, margins, notes or team data.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "numero": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string"
                    },
                    "idioma": {
                        "type": "string"
                    },
                    "opcoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "total": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "prestacoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "anexo": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "condicoes": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "texto_aceitacao": {
                        "type": "string"
                    },
                    "validade_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "impressao_legivel": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pagamentos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M5PagamentoPaciente"
                        }
                    }
                }
            },
            "M5Pagamento": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "proposta_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "sinal",
                            "intercalar",
                            "restante",
                            "consulta",
                            "teleconsulta",
                            "tratamento",
                            "outro",
                            "adiantamento",
                            "pre_pagamento",
                            "vale",
                            "comparticipacao"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "descricao": {
                        "type": "string"
                    },
                    "valor": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "moeda": {
                        "type": "string"
                    },
                    "metodo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "metodo_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pendente",
                            "pago",
                            "falhado",
                            "expirado",
                            "reembolsado",
                            "cancelado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "mb": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "entidade": {
                                "type": "string"
                            },
                            "referencia": {
                                "type": "string"
                            },
                            "valor": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "validade": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            }
                        }
                    },
                    "telefone_mascarado": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ligacao_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "gateway": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "confirmacao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pedido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "pago_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "vence_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "vencido": {
                        "type": "boolean"
                    },
                    "caixa_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "recebido_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "documento": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/M5Documento"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "acoes": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "boolean"
                        }
                    }
                }
            },
            "M5PagamentoPaciente": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "descricao": {
                        "type": "string"
                    },
                    "valor": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "estado": {
                        "type": "string"
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "metodo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mb": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "telefone_mascarado": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ligacao_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "vence_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "pago_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "M5PlanoPagamentos": {
                "type": "object",
                "properties": {
                    "episodio": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "paciente": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            }
                        }
                    },
                    "propostas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "numero": {
                                    "type": "string"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "total": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "aceite_em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                }
                            }
                        }
                    },
                    "totais": {
                        "type": "object",
                        "properties": {
                            "previsto": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "pago": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "pendente": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "vencido": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "saldo": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "progresso": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            }
                        }
                    },
                    "pagamentos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M5Pagamento"
                        }
                    },
                    "documentos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M5Documento"
                        }
                    },
                    "metodos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "presenciais": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "mbway_limite": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "caixa_aberta": {
                        "type": "boolean"
                    },
                    "pode": {
                        "type": "object",
                        "properties": {
                            "editar": {
                                "type": "boolean"
                            },
                            "faturar": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            },
            "M5Documento": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "FT",
                            "FR",
                            "FS",
                            "RG",
                            "NC"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "atcud": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "qr_codigo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "fornecedor": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pedido",
                            "emitido",
                            "anulado",
                            "erro"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "base": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "iva": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "total": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "iva_taxa": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "descricao_servico": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "cliente_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "erro": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "emitido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "enviado_paciente_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "pagamento_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "documento_origem_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "tem_pdf": {
                        "type": "boolean"
                    },
                    "acoes": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "boolean"
                        }
                    }
                }
            },
            "M5Caixa": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "string",
                        "format": "date"
                    },
                    "hoje": {
                        "type": "boolean"
                    },
                    "caixa": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/M5CaixaDia"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "presenciais": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "pode_editar": {
                        "type": "boolean"
                    }
                }
            },
            "M5CaixaDia": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "data": {
                        "type": "string",
                        "format": "date"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "aberta",
                            "fechada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "saldo_inicial": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "aberta_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "aberta_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "fechada_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "fechada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "por_metodo": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "number",
                            "x-unidade": "EUR"
                        }
                    },
                    "reforcos": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "levantamentos": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "esperado": {
                        "type": "object",
                        "properties": {
                            "numerario": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "cartao": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "outros": {
                                "type": "number",
                                "x-unidade": "EUR"
                            }
                        }
                    },
                    "total_recebido": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "eletronicos_do_dia": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "contagem": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "contado": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "diferenca": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "n_pagamentos": {
                        "type": "integer"
                    },
                    "pode": {
                        "type": "object",
                        "properties": {
                            "editar": {
                                "type": "boolean"
                            }
                        }
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "tipo": {
                                    "type": "string",
                                    "enum": [
                                        "pagamento",
                                        "reforco",
                                        "levantamento"
                                    ]
                                },
                                "id": {
                                    "type": "integer"
                                },
                                "hora": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "descricao": {
                                    "type": "string"
                                },
                                "paciente_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "paciente": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "metodo": {
                                    "type": "string"
                                },
                                "metodo_rotulo": {
                                    "type": "string"
                                },
                                "valor": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "por": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                }
            },
            "M5CaixaResumo": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "data": {
                        "type": "string",
                        "format": "date"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "aberta",
                            "fechada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "saldo_inicial": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "total": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "contado": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "diferenca": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    }
                }
            },
            "M5Comissoes": {
                "type": "object",
                "properties": {
                    "de": {
                        "type": "string",
                        "format": "date"
                    },
                    "ate": {
                        "type": "string",
                        "format": "date"
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "totais": {
                        "type": "object",
                        "properties": {
                            "devido": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "pago": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "previsto": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "estornado": {
                                "type": "number",
                                "x-unidade": "EUR"
                            }
                        }
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "tipo": {
                                    "type": "string",
                                    "enum": [
                                        "comissao",
                                        "honorario"
                                    ]
                                },
                                "id": {
                                    "type": "integer"
                                },
                                "utilizador_id": {
                                    "type": "integer"
                                },
                                "pessoa": {
                                    "type": "string"
                                },
                                "estado": {
                                    "type": "string"
                                },
                                "estado_rotulo": {
                                    "type": "string"
                                },
                                "valor": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "base": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "taxa": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "proposta_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "cirurgia_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "descricao": {
                                    "type": "string"
                                },
                                "data": {
                                    "type": "string"
                                },
                                "paga_em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                }
                            }
                        }
                    },
                    "pessoas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "utilizador_id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "devido": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "pago": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "previsto": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "estornado": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "n": {
                                    "type": "integer"
                                }
                            }
                        }
                    },
                    "grafico": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                }
                            }
                        }
                    },
                    "pode": {
                        "type": "object",
                        "properties": {
                            "pagar": {
                                "type": "boolean"
                            },
                            "ver_todos": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            },
            "M5Carteira": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": "integer"
                    },
                    "saldo": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "saldo_centimos": {
                        "type": "integer"
                    },
                    "reembolsavel": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "reembolsavel_centimos": {
                        "type": "integer"
                    },
                    "totais": {
                        "type": "object",
                        "properties": {
                            "dinheiro": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "creditos": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "usos": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "devolucoes": {
                                "type": "number",
                                "x-unidade": "EUR"
                            }
                        }
                    },
                    "movimentos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "tipo": {
                                    "type": "string",
                                    "enum": [
                                        "adiantamento",
                                        "pre_pagamento",
                                        "credito",
                                        "uso",
                                        "devolucao",
                                        "estorno"
                                    ]
                                },
                                "tipo_rotulo": {
                                    "type": "string"
                                },
                                "valor": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "valor_centimos": {
                                    "type": "integer"
                                },
                                "saldo_apos": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "metodo": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "metodo_rotulo": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "motivo": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "pagamento_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "estorno_de_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "estornado": {
                                    "type": "boolean"
                                },
                                "estornavel": {
                                    "type": "boolean"
                                },
                                "local": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "por": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "data": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                }
                            }
                        }
                    },
                    "metodos_devolucao": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "pode": {
                        "type": "object",
                        "properties": {
                            "usar": {
                                "type": "boolean"
                            },
                            "devolver": {
                                "type": "boolean"
                            },
                            "creditar": {
                                "type": "boolean"
                            },
                            "carregar": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            },
            "M5Vale": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "codigo_fim": {
                        "type": "string"
                    },
                    "valor_inicial": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "saldo": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "saldo_centimos": {
                        "type": "integer"
                    },
                    "validade": {
                        "type": "string",
                        "format": "date"
                    },
                    "finalidade": {
                        "type": "string",
                        "enum": [
                            "multipla",
                            "unica"
                        ]
                    },
                    "finalidade_rotulo": {
                        "type": "string"
                    },
                    "procedimento": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "por_pagar",
                            "ativo",
                            "esgotado",
                            "expirado",
                            "anulado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "comprador_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "beneficiario_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mensagem": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pagamento_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "ativado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "local": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "movimentos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "tipo": {
                                    "type": "string"
                                },
                                "tipo_rotulo": {
                                    "type": "string"
                                },
                                "valor": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "saldo_apos": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "pagamento_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "motivo": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "data": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                }
                            }
                        }
                    }
                }
            },
            "M5Terminal": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "fornecedor": {
                        "type": "string",
                        "enum": [
                            "sumup",
                            "stripe"
                        ]
                    },
                    "fornecedor_rotulo": {
                        "type": "string"
                    },
                    "local_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "local": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string"
                    },
                    "ultimo_estado": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "M5PedidoTerminal": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "terminal_id": {
                        "type": "integer"
                    },
                    "terminal": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "fornecedor": {
                        "type": "string"
                    },
                    "fornecedor_rotulo": {
                        "type": "string"
                    },
                    "pagamento_id": {
                        "type": "integer"
                    },
                    "referencia": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "enviado",
                            "pago",
                            "falhado",
                            "cancelado",
                            "expirado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "valor": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "valor_centimos": {
                        "type": "integer"
                    },
                    "mensagem": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "concluido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "acoes": {
                        "type": "object",
                        "properties": {
                            "cancelar": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            },
            "M5Reconciliacao": {
                "type": "object",
                "properties": {
                    "caixa_id": {
                        "type": "integer"
                    },
                    "data": {
                        "type": "string",
                        "format": "date"
                    },
                    "local_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "cartao_manual": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "terminais": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "terminal": {
                                    "$ref": "#/components/schemas/M5Terminal"
                                },
                                "disponivel": {
                                    "type": "boolean"
                                },
                                "pedidos": {
                                    "type": "integer"
                                },
                                "total_registado": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "total_fornecedor": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "EUR"
                                },
                                "diferenca": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "EUR"
                                },
                                "confirmados_agora": {
                                    "type": "integer"
                                },
                                "sem_registo": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "externo_id": {
                                                "type": "string"
                                            },
                                            "referencia": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "valor": {
                                                "type": "number",
                                                "x-unidade": "EUR"
                                            },
                                            "quando": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "M5Reparticao": {
                "type": "object",
                "properties": {
                    "conta": {
                        "type": "object"
                    },
                    "convencao": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "ato": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "preco": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "pagador": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "paciente": {
                        "type": "number",
                        "x-unidade": "EUR"
                    },
                    "exige_autorizacao": {
                        "type": "boolean"
                    },
                    "avisos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "M5ContaExtrato": {
                "type": "object",
                "properties": {
                    "conta": {
                        "type": "object"
                    },
                    "totais": {
                        "type": "object",
                        "properties": {
                            "pendente": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "pago": {
                                "type": "number",
                                "x-unidade": "EUR"
                            },
                            "vencido": {
                                "type": "number",
                                "x-unidade": "EUR"
                            }
                        }
                    },
                    "subcontas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "paciente_id": {
                                    "type": "integer"
                                },
                                "paciente": {
                                    "type": "string"
                                },
                                "relacao": {
                                    "type": "string"
                                },
                                "relacao_rotulo": {
                                    "type": "string"
                                },
                                "numero_beneficiario": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "cobertura_pct": {
                                    "type": "number"
                                },
                                "limite": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "EUR"
                                },
                                "usado_ano": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "disponivel_ano": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "EUR"
                                },
                                "pendente": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "pago": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "vencido": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "n_pagamentos": {
                                    "type": "integer"
                                },
                                "ativa": {
                                    "type": "boolean"
                                },
                                "valida_ate": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date"
                                }
                            }
                        }
                    },
                    "pagamentos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M5Pagamento"
                        }
                    },
                    "documentos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M5Documento"
                        }
                    },
                    "pode": {
                        "type": "object",
                        "properties": {
                            "editar": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            },
            "M5Consumo": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "artigo_id": {
                        "type": "integer"
                    },
                    "artigo": {
                        "type": "string"
                    },
                    "quantidade": {
                        "type": "number"
                    },
                    "unidade": {
                        "type": "string"
                    },
                    "lote": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "validade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "custo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    }
                }
            },
            "M2AvisoCanal": {
                "type": [
                    "object",
                    "null"
                ],
                "description": "Privacy notice in force for the channel, with the token of the version shown.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "canal": {
                        "type": "string"
                    },
                    "canal_rotulo": {
                        "type": "string"
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "texto": {
                        "type": "string",
                        "description": "Sanitised HTML."
                    },
                    "idioma": {
                        "type": "string"
                    },
                    "publicado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "resumo": {
                        "type": "string",
                        "description": "SHA-256 of the published text."
                    },
                    "contexto": {
                        "type": "string"
                    },
                    "testemunho": {
                        "type": "string",
                        "description": "Signed token (24 h)."
                    }
                }
            },
            "M2AvisoMostrado": {
                "type": "object",
                "description": "A recorded (immutable) display of a privacy notice.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "canal": {
                        "type": "string"
                    },
                    "canal_rotulo": {
                        "type": "string"
                    },
                    "aviso": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "versao": {
                                "type": "integer"
                            },
                            "titulo": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "idioma": {
                                "type": "string"
                            }
                        }
                    },
                    "contexto": {
                        "type": "string"
                    },
                    "contexto_rotulo": {
                        "type": "string"
                    },
                    "meio": {
                        "type": "string",
                        "enum": [
                            "web",
                            "app",
                            "externo",
                            "voz",
                            "video",
                            "presencial",
                            "api"
                        ]
                    },
                    "meio_rotulo": {
                        "type": "string"
                    },
                    "prova": {
                        "type": "string",
                        "enum": [
                            "testemunho",
                            "envio",
                            "servidor"
                        ]
                    },
                    "prova_rotulo": {
                        "type": "string"
                    },
                    "titular_tipo": {
                        "type": "string"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "portal_conta_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "ref_tipo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ref_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "mostrado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "registado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "texto_hash": {
                        "type": "string"
                    },
                    "impressao_digital": {
                        "type": "string"
                    },
                    "texto_integro": {
                        "type": [
                            "boolean",
                            "null"
                        ]
                    },
                    "linha_integra": {
                        "type": "boolean"
                    }
                }
            },
            "M2PedidoCmd": {
                "type": "object",
                "description": "Mobile Digital Key signature request (no secrets: never the PIN or the full number).",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "documento_id": {
                        "type": "integer"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "codigo_enviado",
                            "assinado",
                            "falhou",
                            "expirado",
                            "cancelado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "telemovel": {
                        "type": "string",
                        "description": "Mask (+351 9•••••678)."
                    },
                    "titular": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ambiente": {
                        "type": "string"
                    },
                    "pedido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "segundos_restantes": {
                        "type": "integer"
                    },
                    "tentativas": {
                        "type": "integer"
                    },
                    "concluido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "mensagem": {
                        "type": "string"
                    }
                }
            },
            "M2Erro": {
                "type": "object",
                "required": [
                    "codigo",
                    "mensagem"
                ],
                "properties": {
                    "codigo": {
                        "type": "string",
                        "enum": [
                            "validacao",
                            "nao_autenticado",
                            "sem_permissao",
                            "nao_encontrado",
                            "acao_recusada",
                            "limite_excedido"
                        ]
                    },
                    "mensagem": {
                        "type": "string"
                    },
                    "campos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        }
                    }
                },
                "x-catalogo-erros": {
                    "validacao": {
                        "http": 422,
                        "descricao": "Missing decision, missing signature, reflection in progress, template fields, wrong code, missing reason."
                    },
                    "acao_recusada": {
                        "http": 409,
                        "descricao": "Sending the link or the code failed (no contact, messaging service unavailable)."
                    }
                }
            },
            "M2RespostaErro": {
                "type": "object",
                "required": [
                    "ok",
                    "erro"
                ],
                "properties": {
                    "ok": {
                        "const": false
                    },
                    "erro": {
                        "$ref": "#/components/schemas/M2Erro"
                    }
                }
            },
            "M2Entrega": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "modelo_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "modelo_versao": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "entregue_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "liberta_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "segundos_restantes": {
                        "type": "integer",
                        "x-unidade": "s"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "entregue",
                            "assinado",
                            "recusado",
                            "anulado"
                        ]
                    },
                    "documento_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "canal": {
                        "type": "string"
                    }
                }
            },
            "M2ModeloRecolha": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "chave": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "finalidade": {
                        "type": "string",
                        "enum": [
                            "tratamento_clinico",
                            "fotografias_clinicas",
                            "imagens_comunicacao",
                            "captura_3d",
                            "gravacao_chamadas",
                            "gravacao_video",
                            "ia",
                            "agente_voz",
                            "marketing",
                            "partilha_terceiros",
                            "teleconsulta",
                            "cirurgico",
                            "contacto"
                        ]
                    },
                    "finalidade_rotulo": {
                        "type": "string"
                    },
                    "base_legal": {
                        "type": "string"
                    },
                    "base_legal_rotulo": {
                        "type": "string"
                    },
                    "informativo": {
                        "type": "boolean",
                        "description": "The basis is not consent: the patient acknowledges."
                    },
                    "obrigatorio": {
                        "type": "boolean"
                    },
                    "escrito": {
                        "type": "boolean",
                        "description": "Requires the patient signature when given."
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "idioma": {
                        "type": "string"
                    },
                    "texto": {
                        "type": "string",
                        "description": "Sanitised HTML."
                    },
                    "reflexao_horas": {
                        "type": "integer",
                        "x-unidade": "h"
                    },
                    "estado_atual": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "decisao": {
                                "type": "string"
                            },
                            "decisao_rotulo": {
                                "type": "string"
                            },
                            "em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "versao": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "desatualizado": {
                                "type": "boolean"
                            },
                            "falta_medico": {
                                "type": "boolean"
                            }
                        }
                    },
                    "entrega": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/M2Entrega"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "cirurgico": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "valido": {
                                "type": "boolean"
                            },
                            "motivos": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "codigo": {
                                            "type": "string",
                                            "enum": [
                                                "sem_consentimento",
                                                "recusado",
                                                "revogado",
                                                "tecnica_diferente",
                                                "sem_informacao",
                                                "reflexao",
                                                "sem_assinatura_medico",
                                                "plano_alterado"
                                            ]
                                        },
                                        "texto": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "plano": {
                                "type": [
                                    "object",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            },
            "M2Recolha": {
                "type": "object",
                "properties": {
                    "paciente": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "numero": {
                                "type": "string"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "idioma": {
                                "type": "string"
                            },
                            "tem_email": {
                                "type": "boolean"
                            },
                            "tem_telefone": {
                                "type": "boolean"
                            },
                            "portal_ativo": {
                                "type": "boolean"
                            }
                        }
                    },
                    "episodio": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "episodios": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "aviso": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "canal": {
                                "type": "string"
                            },
                            "versao": {
                                "type": "integer"
                            },
                            "titulo": {
                                "type": "string"
                            },
                            "texto": {
                                "type": "string"
                            },
                            "visto_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            }
                        }
                    },
                    "modelos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/M2ModeloRecolha"
                        }
                    },
                    "medicos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "cedula": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "agora": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "pode_editar": {
                        "type": "boolean"
                    }
                }
            },
            "M2Prova": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "paciente": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "finalidade": {
                        "type": "string"
                    },
                    "finalidade_rotulo": {
                        "type": "string"
                    },
                    "decisao": {
                        "type": "string"
                    },
                    "decisao_rotulo": {
                        "type": "string"
                    },
                    "canal": {
                        "type": "string"
                    },
                    "canal_rotulo": {
                        "type": "string"
                    },
                    "modelo": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "texto": {
                        "type": "string"
                    },
                    "texto_hash": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "texto_integro": {
                        "type": [
                            "boolean",
                            "null"
                        ]
                    },
                    "informacao_entregue_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "assinado_paciente_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "assinado_medico_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "medico": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "recolhido_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "plano_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "dispositivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ip": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "impressao_digital": {
                        "type": "string"
                    },
                    "registado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "assinatura": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "ficheiro_id": {
                                "type": "integer"
                            },
                            "sha256": {
                                "type": "string"
                            },
                            "url": {
                                "type": "string"
                            }
                        }
                    },
                    "assinatura_medico": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "entrega": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "entidade": {
                        "type": "object"
                    }
                }
            },
            "M2ModeloDocumento": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "chave": {
                        "type": "string"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "proposta",
                            "consentimento",
                            "instrucoes",
                            "declaracao",
                            "relatorio",
                            "alta",
                            "carta"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "clinico": {
                        "type": "boolean"
                    },
                    "assinatura": {
                        "type": "boolean"
                    },
                    "assinatura_medico": {
                        "type": "boolean"
                    },
                    "partilhar_padrao": {
                        "type": "boolean"
                    },
                    "campos_extra": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "tipo": {
                                    "type": "string",
                                    "enum": [
                                        "texto",
                                        "textoLongo",
                                        "data",
                                        "numero"
                                    ]
                                },
                                "obrigatorio": {
                                    "type": "boolean"
                                }
                            }
                        }
                    }
                }
            },
            "M2Documento": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "clinico": {
                        "type": "boolean"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "modelo_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "modelo_versao": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "emitido",
                            "enviado",
                            "assinado",
                            "anulado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "codigo_verificacao": {
                        "type": "string"
                    },
                    "url_verificacao": {
                        "type": "string"
                    },
                    "conteudo_hash": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "assinatura_tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "ecra",
                            "codigo",
                            "qualificada",
                            null
                        ]
                    },
                    "assinatura_canal": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "assinatura_destino": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Masked."
                    },
                    "assinatura_expira": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "assinado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "assinado_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "libertado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "End of the reflection period (consents sent home)."
                    },
                    "partilhado_paciente": {
                        "type": "boolean"
                    },
                    "enviado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "anulado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "anulado_motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tem_pdf": {
                        "type": "boolean"
                    },
                    "certificado": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "pode_ver_conteudo": {
                        "type": "boolean"
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "conteudo": {
                        "type": "string",
                        "description": "HTML; only with pode_ver_conteudo."
                    },
                    "paciente": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "assinatura_medico": {
                        "type": "boolean"
                    },
                    "eventos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "acao": {
                                    "type": "string"
                                },
                                "acao_rotulo": {
                                    "type": "string"
                                },
                                "quem": {
                                    "type": "string"
                                },
                                "origem": {
                                    "type": "string"
                                },
                                "detalhe": {
                                    "type": [
                                        "object",
                                        "null"
                                    ]
                                },
                                "motivo": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "pode_editar": {
                        "type": "boolean"
                    }
                }
            },
            "M2Verificacao": {
                "type": "object",
                "properties": {
                    "valido": {
                        "type": "boolean"
                    },
                    "estado": {
                        "type": "string"
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "codigo_verificacao": {
                        "type": "string"
                    },
                    "emitido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "assinado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "assinatura_tipo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "anulado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "conteudo_hash": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ficheiro_sha256": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "titular_iniciais": {
                        "type": "string"
                    },
                    "medico": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "nome": {
                                "type": "string"
                            },
                            "cedula": {
                                "type": "string"
                            }
                        }
                    },
                    "entidade": {
                        "type": "object",
                        "properties": {
                            "nome": {
                                "type": "string"
                            },
                            "nome_legal": {
                                "type": "string"
                            },
                            "nif": {
                                "type": "string"
                            },
                            "ers_registo": {
                                "type": "string"
                            },
                            "licenca_numero": {
                                "type": "string"
                            },
                            "morada": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "M2Painel": {
                "type": "object",
                "properties": {
                    "atualizado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "kpis": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "valor": {
                                    "type": "integer"
                                },
                                "atrasados": {
                                    "type": "integer"
                                },
                                "tom": {
                                    "type": "string"
                                },
                                "ligacao": {
                                    "type": "object",
                                    "properties": {
                                        "web": {
                                            "type": "string"
                                        },
                                        "app": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "pedidos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "reclamacoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "incidentes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "alertas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "subcontratantes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "subcontratantes_plataforma": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "rat": {
                        "type": "object"
                    },
                    "formacoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "ers": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "revisao": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "consentimentos": {
                        "type": "object"
                    },
                    "equipamentos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "modelos_por_aprovar": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "conservacao": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "encarregado": {
                        "type": "object",
                        "properties": {
                            "nome": {
                                "type": "string"
                            },
                            "email": {
                                "type": "string"
                            }
                        }
                    },
                    "permissoes": {
                        "type": "object",
                        "properties": {
                            "editar": {
                                "type": "boolean"
                            },
                            "alertas": {
                                "type": "boolean"
                            },
                            "alertas_editar": {
                                "type": "boolean"
                            },
                            "revisao": {
                                "type": "boolean"
                            },
                            "revisao_editar": {
                                "type": "boolean"
                            },
                            "exportar": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            },
            "M2Revisao": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "periodo": {
                        "type": "string",
                        "description": "Quarter, e.g. 2026-T4."
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "em_curso",
                            "concluida"
                        ]
                    },
                    "iniciada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "revisto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "revisto_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "utilizadores_n": {
                        "type": "integer"
                    },
                    "sensiveis_n": {
                        "type": "integer"
                    },
                    "alteracoes": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pessoas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "perfil": {
                                    "type": "string"
                                },
                                "direcao_clinica": {
                                    "type": "boolean"
                                },
                                "global": {
                                    "type": "boolean"
                                },
                                "segundo_fator": {
                                    "type": "boolean"
                                },
                                "rede_restrita": {
                                    "type": "boolean"
                                },
                                "ultimo_acesso_em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "sem_acesso_90d": {
                                    "type": "boolean"
                                },
                                "delegacoes": {
                                    "type": "integer"
                                },
                                "emergencias_90d": {
                                    "type": "integer"
                                },
                                "alertas_90d": {
                                    "type": "integer"
                                },
                                "clinico": {
                                    "type": "boolean"
                                },
                                "atencao": {
                                    "type": "boolean"
                                },
                                "modulos": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "modulo": {
                                                "type": "string"
                                            },
                                            "rotulo": {
                                                "type": "string"
                                            },
                                            "nivel": {
                                                "type": "string"
                                            },
                                            "ambito": {
                                                "type": "string"
                                            },
                                            "origem": {
                                                "type": "string"
                                            },
                                            "clinico": {
                                                "type": "boolean"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "M2Acessos": {
                "type": "object",
                "properties": {
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "quem": {
                                    "type": "string"
                                },
                                "ator_tipo": {
                                    "type": "string"
                                },
                                "perfil": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "perfil_rotulo": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "acao": {
                                    "type": "string"
                                },
                                "acao_rotulo": {
                                    "type": "string"
                                },
                                "recurso": {
                                    "type": "string"
                                },
                                "recurso_rotulo": {
                                    "type": "string"
                                },
                                "origem": {
                                    "type": "string"
                                },
                                "motivo": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "emergencia": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "resumo": {
                        "type": "object",
                        "properties": {
                            "total": {
                                "type": "integer"
                            },
                            "pessoas": {
                                "type": "integer"
                            },
                            "perfis": {
                                "type": "integer"
                            },
                            "emergencias": {
                                "type": "integer"
                            },
                            "ultimo": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "limitado": {
                                "type": "boolean"
                            }
                        }
                    },
                    "por_dia": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string",
                                    "format": "date"
                                },
                                "y": {
                                    "type": "integer"
                                }
                            }
                        }
                    },
                    "pessoas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "nome": {
                                    "type": "string"
                                },
                                "perfil": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "perfil_chave": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "acessos": {
                                    "type": "integer"
                                },
                                "ultimo": {
                                    "type": "string"
                                },
                                "ultimo_iso": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "emergencia": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "por_acao": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "integer"
                                },
                                "acao": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "CrmCartaoFunil": {
                "type": "object",
                "description": "Lead card in the funnel (no clinical data). «valor» only with the financeiro.valores permission.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "responsavel": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "cor": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "origem": {
                        "type": "string",
                        "enum": [
                            "site",
                            "pre_avaliacao",
                            "meta",
                            "google",
                            "whatsapp",
                            "instagram",
                            "messenger",
                            "telefone",
                            "presencial",
                            "recomendacao",
                            "agente_voz",
                            "outro"
                        ]
                    },
                    "origem_rotulo": {
                        "type": "string"
                    },
                    "procedimento": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            }
                        }
                    },
                    "proxima_acao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "proxima_acao_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "sla_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "sla_atrasado": {
                        "type": "boolean"
                    },
                    "decisao": {
                        "type": "string",
                        "enum": [
                            "por_decidir",
                            "confirmado",
                            "indeciso",
                            "recusado"
                        ]
                    },
                    "decisao_rotulo": {
                        "type": "string"
                    },
                    "motivo_indecisao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "valor_em_risco": {
                        "type": "boolean"
                    },
                    "pontuacao": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100
                    },
                    "proposta_parada": {
                        "type": "boolean"
                    },
                    "duplicado": {
                        "type": "boolean"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "dias_na_fase": {
                        "type": "integer"
                    },
                    "motivo_perda": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "preco",
                            "prazo",
                            "concorrencia",
                            "nao_elegivel",
                            "sem_resposta",
                            "outro",
                            null
                        ]
                    },
                    "motivo_perda_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "CrmFunil": {
                "type": "object",
                "properties": {
                    "fases": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "chave": {
                                    "type": "string"
                                },
                                "tipo": {
                                    "type": "string",
                                    "enum": [
                                        "aberta",
                                        "ganha",
                                        "perdida"
                                    ]
                                },
                                "cor": {
                                    "type": "string"
                                },
                                "sla_horas": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "total": {
                                    "type": "integer"
                                },
                                "valor": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "mais": {
                                    "type": "integer",
                                    "description": "Stage leads beyond the returned cards."
                                },
                                "cartoes": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/CrmCartaoFunil"
                                    }
                                }
                            }
                        }
                    },
                    "total": {
                        "type": "integer"
                    },
                    "kpis": {
                        "type": "object",
                        "properties": {
                            "abertos": {
                                "type": "integer"
                            },
                            "por_responder": {
                                "type": "integer"
                            },
                            "paradas": {
                                "type": "integer"
                            },
                            "ganhos_mes": {
                                "type": "integer"
                            },
                            "valor_aberto": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            }
                        }
                    },
                    "pode_valores": {
                        "type": "boolean"
                    },
                    "pode_editar": {
                        "type": "boolean"
                    },
                    "objetivos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "metrica": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "quem": {
                                    "type": "string"
                                },
                                "alvo": {
                                    "type": "number"
                                },
                                "atual": {
                                    "type": "number"
                                },
                                "percentagem": {
                                    "type": "number",
                                    "x-unidade": "%"
                                },
                                "moeda": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "motivos_perda": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "valor": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "filtros": {
                        "type": "object",
                        "description": "Options {valor, rotulo} for each filter: responsavel_id, origem, procedimento_id, decisao, sla.",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "valor": {
                                        "type": "string"
                                    },
                                    "rotulo": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    },
                    "ativos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "nome": {
                                    "type": "string"
                                },
                                "campo": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "valor": {
                                    "type": "string"
                                },
                                "valorParam": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "CrmLeadDetalhe": {
                "type": "object",
                "description": "Lead detail: commercial and administrative data only. The timeline excludes the clinical category. Reads are audited.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tel": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "data_nascimento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "origem": {
                        "type": "string",
                        "enum": [
                            "site",
                            "pre_avaliacao",
                            "meta",
                            "google",
                            "whatsapp",
                            "instagram",
                            "messenger",
                            "telefone",
                            "presencial",
                            "recomendacao",
                            "agente_voz",
                            "outro"
                        ]
                    },
                    "origem_rotulo": {
                        "type": "string"
                    },
                    "campanha": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "utm": {
                        "type": "object",
                        "properties": {
                            "source": {
                                "type": "string"
                            },
                            "medium": {
                                "type": "string"
                            },
                            "campaign": {
                                "type": "string"
                            },
                            "term": {
                                "type": "string"
                            },
                            "content": {
                                "type": "string"
                            }
                        }
                    },
                    "procedimento": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "fase": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "tipo": {
                                "type": "string"
                            },
                            "cor": {
                                "type": "string"
                            }
                        }
                    },
                    "responsavel": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "cor": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "pontuacao": {
                        "type": "integer"
                    },
                    "decisao": {
                        "type": "string",
                        "enum": [
                            "por_decidir",
                            "confirmado",
                            "indeciso",
                            "recusado"
                        ]
                    },
                    "decisao_rotulo": {
                        "type": "string"
                    },
                    "motivo_indecisao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "valor_estimado": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "motivo_perda": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo_perda_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "proxima_acao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "proxima_acao_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "sla_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "sla_atrasado": {
                        "type": "boolean"
                    },
                    "primeira_resposta_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "ultimo_contacto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "convertido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "recomendado_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "recompensa_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "pendente",
                            "atribuida",
                            null
                        ]
                    },
                    "consentimento_contacto": {
                        "type": "boolean"
                    },
                    "marketing": {
                        "type": "object",
                        "properties": {
                            "decisao": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "valido": {
                                "type": "boolean"
                            },
                            "adesao_confirmada_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            }
                        }
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "conversas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "chamadas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "cronologia": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "duplicados": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/CrmDuplicado"
                        }
                    },
                    "fases": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "equipa": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "motivos_perda": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "decisoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "pode_editar": {
                        "type": "boolean"
                    },
                    "pode_valores": {
                        "type": "boolean"
                    },
                    "pode_converter": {
                        "type": "boolean"
                    }
                }
            },
            "CrmDuplicado": {
                "type": "object",
                "properties": {
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "lead",
                            "paciente"
                        ]
                    },
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "motivos": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "telefone",
                                "email",
                                "nif",
                                "nome_data"
                            ]
                        }
                    },
                    "forte": {
                        "type": "boolean"
                    },
                    "convertido": {
                        "type": "boolean"
                    },
                    "perdido": {
                        "type": "boolean"
                    }
                }
            },
            "CrmConversaLinha": {
                "type": "object",
                "description": "Inbox row. In clinical-department conversations, «previa» only shows the text to users who can see the clinical record.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "canal": {
                        "type": "string",
                        "enum": [
                            "portal",
                            "whatsapp",
                            "instagram",
                            "messenger",
                            "email",
                            "chat_site",
                            "sms"
                        ]
                    },
                    "canal_rotulo": {
                        "type": "string"
                    },
                    "contacto": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pessoa": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "tipo": {
                                "type": "string",
                                "enum": [
                                    "paciente",
                                    "lead"
                                ]
                            },
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            }
                        }
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "aberta",
                            "pendente",
                            "resolvida"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao",
                            null
                        ]
                    },
                    "departamento_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "atribuida_a": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "cor": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "ia_a_tratar": {
                        "type": "boolean"
                    },
                    "aguarda_resposta": {
                        "type": "boolean"
                    },
                    "sla_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "atrasada": {
                        "type": "boolean"
                    },
                    "ultima_mensagem_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "previa": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "assunto": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "avaliacao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 5
                    }
                }
            },
            "CrmMensagem": {
                "type": "object",
                "description": "Conversation message. «corpo» and «traducao» are null when the content is reserved to the clinical team.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "direcao": {
                        "type": "string",
                        "enum": [
                            "entrada",
                            "saida",
                            "nota"
                        ]
                    },
                    "autor_tipo": {
                        "type": "string",
                        "enum": [
                            "contacto",
                            "equipa",
                            "agente",
                            "sistema"
                        ]
                    },
                    "autor": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "cor": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "canal": {
                        "type": "string"
                    },
                    "corpo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "traducao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "anexos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "ficheiro_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "tipo": {
                                    "type": "string"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "url": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "na_ficha": {
                                    "type": "boolean"
                                },
                                "visivel": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "estado_entrega": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "enviada",
                            "entregue",
                            "lida",
                            "falhada",
                            null
                        ]
                    },
                    "estado_entrega_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ia": {
                        "type": "boolean",
                        "description": "Written by the virtual assistant."
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "CrmConversaDetalhe": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/CrmConversaLinha"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "mensagens": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/CrmMensagem"
                                }
                            },
                            "conteudo_visivel": {
                                "type": "boolean"
                            },
                            "outras_conversas": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "canal": {
                                            "type": "string"
                                        },
                                        "estado": {
                                            "type": "string"
                                        },
                                        "ultima_mensagem_em": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "format": "date-time"
                                        }
                                    }
                                }
                            },
                            "transferencias": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "avaliacao_comentario": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "respostas_rapidas": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "titulo": {
                                            "type": "string"
                                        },
                                        "atalho": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "corpo": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "canais_reenvio": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "ia": {
                                "type": "object",
                                "properties": {
                                    "traducao": {
                                        "type": "boolean"
                                    },
                                    "respostas": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "equipa": {
                                "type": "array",
                                "description": "People to assign (only for editors and without depois_de).",
                                "items": {
                                    "type": [
                                        "object",
                                        "null"
                                    ],
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "nome": {
                                            "type": "string"
                                        },
                                        "cor": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    }
                                }
                            },
                            "pode_editar": {
                                "type": "boolean"
                            }
                        }
                    }
                ]
            },
            "CrmListaChamadas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "reativacao",
                            "confirmacoes",
                            "propostas_paradas",
                            "pos_operatorio",
                            "leads_fase",
                            "lembretes"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "finalidade": {
                        "type": "string",
                        "enum": [
                            "servico",
                            "comercial"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "rascunho",
                            "ativa",
                            "pausada",
                            "concluida"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "total": {
                        "type": "integer"
                    },
                    "concluidos": {
                        "type": "integer"
                    },
                    "bloqueados": {
                        "type": "integer"
                    },
                    "guiao_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "executor": {
                        "type": "string",
                        "enum": [
                            "pessoa",
                            "agente"
                        ],
                        "description": "«agente»: the list is called by the voice agent (no «next contact»)."
                    },
                    "executor_rotulo": {
                        "type": "string"
                    },
                    "janela": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "CrmContactoMarcador": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "campanha_id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pendente",
                            "em_curso",
                            "concluido",
                            "bloqueado",
                            "reagendado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "resultado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "marcou_consulta",
                            "interessado",
                            "ligar_mais_tarde",
                            "sem_interesse",
                            "nao_atendeu",
                            "numero_errado",
                            "pediu_nao_contactar",
                            "confirmou",
                            "remarcou",
                            "cancelou",
                            null
                        ]
                    },
                    "resultado_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo_bloqueio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "sem_consentimento",
                            "suprimido",
                            null
                        ]
                    },
                    "tentativas": {
                        "type": "integer"
                    },
                    "proxima_tentativa_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "respostas": {
                        "type": "object"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tel": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "CrmGuiao": {
                "type": [
                    "object",
                    "null"
                ],
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "finalidade": {
                        "type": "string"
                    },
                    "abertura": {
                        "type": "string",
                        "description": "With {colaborador} and {clinica} already replaced."
                    },
                    "passos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "titulo": {
                                    "type": "string"
                                },
                                "texto": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "campos_obrigatorios": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "tipo": {
                                    "type": "string",
                                    "enum": [
                                        "texto",
                                        "escolha",
                                        "booleano",
                                        "data"
                                    ]
                                },
                                "opcoes": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "CrmEstatisticasChamadas": {
                "type": "object",
                "properties": {
                    "de": {
                        "type": "string",
                        "format": "date"
                    },
                    "ate": {
                        "type": "string",
                        "format": "date"
                    },
                    "totais": {
                        "type": "object",
                        "properties": {
                            "atendidas": {
                                "type": "integer"
                            },
                            "perdidas": {
                                "type": "integer"
                            },
                            "fora_horas": {
                                "type": "integer"
                            },
                            "saida": {
                                "type": "integer"
                            },
                            "por_devolver": {
                                "type": "integer"
                            }
                        }
                    },
                    "por_pessoa": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "utilizador_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "cor": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "atendidas": {
                                    "type": "integer"
                                },
                                "perdidas": {
                                    "type": "integer"
                                },
                                "fora_horas": {
                                    "type": "integer"
                                },
                                "saida": {
                                    "type": "integer"
                                },
                                "devolver_min": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "x-unidade": "min"
                                }
                            }
                        }
                    },
                    "calor": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "number"
                                },
                                "serie": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                }
            },
            "CrmPedidoAgente": {
                "type": "object",
                "description": "AI agent request. In the detail, «transcricao», «notas_relatadas», «sinais» and the recording are only returned to users who can see the clinical record (conteudo_clinico = true).",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "canal": {
                        "type": "string",
                        "enum": [
                            "voz",
                            "whatsapp",
                            "chat"
                        ]
                    },
                    "canal_rotulo": {
                        "type": "string"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "marcacao",
                            "informacao",
                            "pos_operatorio",
                            "pagamento",
                            "alarme",
                            "outro"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "ia_a_tratar",
                            "passado_equipa",
                            "resolvido",
                            "validado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "pessoa": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "tipo": {
                                "type": "string"
                            },
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            }
                        }
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "intencao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "proximo_passo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "sinal_alarme": {
                        "type": "boolean"
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "resumo_reservado": {
                        "type": "boolean"
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "duracao_s": {
                        "type": "integer",
                        "x-unidade": "s"
                    },
                    "aviso_ia": {
                        "type": "boolean"
                    },
                    "identificacao_verificada": {
                        "type": "boolean"
                    },
                    "amostra": {
                        "type": "boolean"
                    },
                    "revisao_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "conforme",
                            "a_corrigir",
                            null
                        ]
                    },
                    "conversa_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "marcacao_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "assumido_por": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "transcricao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "notas_relatadas": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "sinais": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "conteudo_clinico": {
                        "type": "boolean"
                    },
                    "marcacao_pedida": {
                        "type": "object"
                    },
                    "gravacao_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "revisao_nota": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "validado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "correcao_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "pode_validar": {
                        "type": "boolean"
                    },
                    "pode_editar": {
                        "type": "boolean"
                    },
                    "motor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "externo",
                            "proprio",
                            null
                        ],
                        "description": "Who ran the voice call: the external provider or the AnagenSys own engine."
                    },
                    "motor_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "servico_ia": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "local",
                            "externo",
                            "misto",
                            null
                        ],
                        "description": "Own engine: which AI service was used (local, external or both)."
                    },
                    "servico_ia_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "sessao_voz": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/CrmSessaoVoz"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Detail and own engine only."
                    },
                    "turnos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/CrmTurnoVoz"
                        },
                        "description": "Detail and own engine only. The text of each turn is only returned to users who can see the clinical record."
                    },
                    "direcao": {
                        "type": "string",
                        "enum": [
                            "entrada",
                            "saida"
                        ]
                    },
                    "direcao_rotulo": {
                        "type": "string"
                    },
                    "resumo_sem_dados_pessoais": {
                        "type": "boolean",
                        "description": "The returned «resumo» is the version without personal data (for those who cannot see the clinical record)."
                    },
                    "transcricao_limpa": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Detail only: version without personal data ([NOME], [TELEFONE]… markers); null in clinical requests for those who cannot see the clinical record."
                    },
                    "limpeza_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "regras",
                            "ia",
                            "falhou",
                            null
                        ]
                    },
                    "limpeza_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "saida": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Detail only: the dialler list of a call made by the agent.",
                        "properties": {
                            "lista_id": {
                                "type": "integer"
                            },
                            "lista": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "tipo": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "tipo_rotulo": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "resultado": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "resultado_rotulo": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "tentativas": {
                                "type": "integer"
                            }
                        }
                    },
                    "turnos_sem_dados_pessoais": {
                        "type": "boolean"
                    }
                }
            },
            "CrmSessaoVoz": {
                "type": "object",
                "description": "Call handled by the own voice engine.",
                "properties": {
                    "estado": {
                        "type": "string",
                        "enum": [
                            "ativa",
                            "transferida",
                            "terminada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "lingua": {
                        "type": "string"
                    },
                    "turnos": {
                        "type": "integer"
                    },
                    "segundos_audio": {
                        "type": "integer",
                        "x-unidade": "s"
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "acao_final": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "continuar",
                            "transferir",
                            "terminar",
                            null
                        ]
                    },
                    "acao_final_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo_fim": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo_fim_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "gravacao_consentida": {
                        "type": "boolean"
                    }
                }
            },
            "CrmTurnoVoz": {
                "type": "object",
                "description": "A caller turn («pessoa») or an agent answer («agente»; «sistema» for fixed phrases). Turn audio is never stored.",
                "properties": {
                    "ordem": {
                        "type": "integer"
                    },
                    "papel": {
                        "type": "string",
                        "enum": [
                            "pessoa",
                            "agente",
                            "sistema"
                        ]
                    },
                    "papel_rotulo": {
                        "type": "string"
                    },
                    "texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Null for users who cannot see the clinical record."
                    },
                    "lingua": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "acao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "continuar",
                            "transferir",
                            "terminar",
                            null
                        ]
                    },
                    "acao_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "servicos": {
                        "type": "object",
                        "properties": {
                            "transcricao": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "local",
                                    "externo",
                                    "ponte",
                                    null
                                ]
                            },
                            "resposta": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "local",
                                    "externo",
                                    null
                                ]
                            },
                            "fala": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "local",
                                    "externo",
                                    "ponte",
                                    null
                                ]
                            }
                        }
                    },
                    "servicos_rotulos": {
                        "type": "object"
                    },
                    "duracao_audio_ms": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "latencia_ms": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "CrmRespostaVoz": {
                "type": "object",
                "description": "Voice engine answer to the phone bridge. The text is always present (the bridge can use its own voice when there is no audio).",
                "required": [
                    "sessao",
                    "texto",
                    "acao",
                    "lingua"
                ],
                "properties": {
                    "sessao": {
                        "type": "string",
                        "description": "The bridge call_id."
                    },
                    "pedido_id": {
                        "type": "integer"
                    },
                    "turno": {
                        "type": "integer"
                    },
                    "lingua": {
                        "type": "string",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ]
                    },
                    "texto": {
                        "type": "string"
                    },
                    "audio": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Null when audio_modo = nenhum or speech failed. «base64» or «url» (signed link, 120 s, single use) depending on audio_modo.",
                        "properties": {
                            "formato": {
                                "type": "string",
                                "enum": [
                                    "wav",
                                    "mp3"
                                ]
                            },
                            "mime": {
                                "type": "string"
                            },
                            "duracao_ms": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "base64": {
                                "type": "string"
                            },
                            "url": {
                                "type": "string",
                                "format": "uri"
                            },
                            "expira_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            }
                        }
                    },
                    "acao": {
                        "type": "string",
                        "enum": [
                            "continuar",
                            "transferir",
                            "terminar",
                            "recolher",
                            "correio_voz"
                        ],
                        "description": "continuar: play and listen to the next utterance; recolher (menu): play and wait for a key or a short utterance (see «recolher»); transferir: to «destino»; correio_voz: play, record the message (see «correio_voz») and send it in /ganchos/voz/fim; terminar: play and hang up."
                    },
                    "destino": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Only with acao = transferir. The bridge uses «extensao» or «numero»; with neither, it chooses by department.",
                        "properties": {
                            "tipo": {
                                "type": "string",
                                "enum": [
                                    "departamento",
                                    "extensao",
                                    "gestor"
                                ]
                            },
                            "departamento": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "rececao",
                                    "comercial",
                                    "enfermagem",
                                    "medico",
                                    "tecnico",
                                    "administracao",
                                    null
                                ]
                            },
                            "departamento_rotulo": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "numero": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "extensao": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "utilizador_id": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "utilizador_email": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "utilizador_nome": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "servicos": {
                        "type": "object",
                        "properties": {
                            "transcricao": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "local",
                                    "externo",
                                    "ponte",
                                    null
                                ]
                            },
                            "resposta": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "local",
                                    "externo",
                                    null
                                ]
                            },
                            "fala": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "local",
                                    "externo",
                                    "ponte",
                                    null
                                ]
                            }
                        }
                    },
                    "max_segundos_fala": {
                        "type": "integer",
                        "x-unidade": "s"
                    },
                    "inicio": {
                        "type": "boolean"
                    },
                    "repetido": {
                        "type": "boolean"
                    },
                    "modo": {
                        "type": "string",
                        "enum": [
                            "agente",
                            "menu",
                            "saida"
                        ]
                    },
                    "recolher": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Only with acao = recolher.",
                        "properties": {
                            "teclas": {
                                "type": "array",
                                "items": {
                                    "type": "string",
                                    "enum": [
                                        "0",
                                        "1",
                                        "2",
                                        "3",
                                        "4",
                                        "5",
                                        "6",
                                        "7",
                                        "8",
                                        "9",
                                        "*",
                                        "#"
                                    ]
                                }
                            },
                            "voz": {
                                "type": "boolean",
                                "description": "There are voice options: also send the utterance."
                            },
                            "max_digitos": {
                                "type": "integer"
                            },
                            "espera_s": {
                                "type": "integer",
                                "x-unidade": "s"
                            },
                            "max_segundos_fala": {
                                "type": "integer",
                                "x-unidade": "s"
                            }
                        }
                    },
                    "correio_voz": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Only with acao = correio_voz.",
                        "properties": {
                            "max_segundos": {
                                "type": "integer",
                                "x-unidade": "s"
                            },
                            "departamento": {
                                "type": "string",
                                "enum": [
                                    "rececao",
                                    "comercial",
                                    "enfermagem",
                                    "medico",
                                    "tecnico",
                                    "administracao"
                                ]
                            }
                        }
                    },
                    "identificacao": {
                        "type": "string",
                        "enum": [
                            "nao",
                            "codigo_enviado",
                            "verificada",
                            "falhou"
                        ],
                        "description": "Identification by SMS code to the registered number: until «verificada», the agent only gives general information."
                    }
                }
            },
            "CrmConsumoAgente": {
                "type": "object",
                "properties": {
                    "mes": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}$"
                    },
                    "minutos": {
                        "type": "number",
                        "x-unidade": "min"
                    },
                    "chamadas": {
                        "type": "integer"
                    },
                    "conversas": {
                        "type": "integer"
                    },
                    "limite_minutos": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "limite_conversas": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "pct_minutos": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "%"
                    },
                    "pct_conversas": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "%"
                    },
                    "alerta": {
                        "type": "boolean"
                    }
                }
            },
            "MktBloco": {
                "type": "object",
                "required": [
                    "tipo"
                ],
                "description": "Editor block. «texto» accepts simple HTML (sanitised); «botao» only accepts https://, mailto: or tel:; «imagem» must come from the library with consent valid for the channel.",
                "properties": {
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "titulo",
                            "texto",
                            "imagem",
                            "botao",
                            "divisoria"
                        ]
                    },
                    "texto": {
                        "type": "string"
                    },
                    "html": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string"
                    },
                    "imagem_id": {
                        "type": "integer"
                    },
                    "legenda": {
                        "type": "string"
                    }
                }
            },
            "MktCampanha": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "canal": {
                        "type": "string",
                        "enum": [
                            "email",
                            "sms",
                            "whatsapp"
                        ]
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "informacao",
                            "novidade",
                            "evento",
                            "avaliacao",
                            "reativacao"
                        ]
                    },
                    "finalidade": {
                        "type": "string",
                        "enum": [
                            "marketing",
                            "servico"
                        ]
                    },
                    "segmento_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "assunto": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pre_cabecalho": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "conteudo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Plain text (SMS and WhatsApp)."
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "rascunho",
                            "em_aprovacao",
                            "aprovada",
                            "agendada",
                            "a_enviar",
                            "enviada",
                            "cancelada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "aprovado_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "aprovacao_nota": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "aprovacao_pedida_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "agendada_para": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "enviada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "total": {
                        "type": "integer"
                    },
                    "entregues": {
                        "type": "integer"
                    },
                    "cliques": {
                        "type": "integer"
                    },
                    "anulacoes": {
                        "type": "integer"
                    },
                    "conversoes": {
                        "type": "integer"
                    },
                    "editavel": {
                        "type": "boolean"
                    }
                }
            },
            "MktEditorCampanha": {
                "type": "object",
                "properties": {
                    "campanha": {
                        "$ref": "#/components/schemas/MktCampanha"
                    },
                    "blocos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/MktBloco"
                        }
                    },
                    "imagens": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "url": {
                                    "type": "string"
                                },
                                "canais": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "valido_ate": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "segmentos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "contagem": {
                                    "type": "integer"
                                },
                                "usa_dados_clinicos": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "avisos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "tom": {
                                    "type": "string",
                                    "enum": [
                                        "info",
                                        "aviso",
                                        "perigo"
                                    ]
                                },
                                "texto": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "rodape": {
                        "type": "object",
                        "description": "Clinic legal identification in the footer (name, tax number, regulator registration, licence, address)."
                    },
                    "permissoes": {
                        "type": "object",
                        "properties": {
                            "editar": {
                                "type": "boolean"
                            },
                            "aprovar": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            },
            "MktResultados": {
                "type": "object",
                "properties": {
                    "de": {
                        "type": "string",
                        "format": "date"
                    },
                    "ate": {
                        "type": "string",
                        "format": "date"
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "plataforma": {
                                    "type": "string",
                                    "enum": [
                                        "meta",
                                        "google",
                                        "tiktok",
                                        "linkedin",
                                        "outra"
                                    ]
                                },
                                "plataforma_rotulo": {
                                    "type": "string"
                                },
                                "campanha": {
                                    "type": "string"
                                },
                                "custo": {
                                    "type": "number",
                                    "x-unidade": "EUR"
                                },
                                "impressoes": {
                                    "type": "integer"
                                },
                                "cliques": {
                                    "type": "integer"
                                },
                                "leads_plataforma": {
                                    "type": "integer"
                                },
                                "leads": {
                                    "type": "integer"
                                },
                                "consultas": {
                                    "type": "integer"
                                },
                                "cirurgias": {
                                    "type": "integer"
                                },
                                "custo_por_lead": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "EUR"
                                },
                                "custo_por_consulta": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "EUR"
                                },
                                "custo_por_cirurgia": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "EUR"
                                }
                            }
                        }
                    },
                    "totais": {
                        "type": "object"
                    },
                    "leads_por_origem": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "number"
                                },
                                "serie": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "custo_por_dia": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "number"
                                },
                                "serie": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                }
            },
            "CrmTemposFases": {
                "type": "object",
                "description": "Time in each funnel stage: average of the stays that ended in the period (seconds), leads still in the stage and a matrix per owner. crm.leads scope applied.",
                "properties": {
                    "de": {
                        "type": "string",
                        "format": "date"
                    },
                    "ate": {
                        "type": "string",
                        "format": "date"
                    },
                    "funil_id": {
                        "type": "integer"
                    },
                    "fases": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "chave": {
                                    "type": "string"
                                },
                                "cor": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "tipo": {
                                    "type": "string"
                                },
                                "sla_horas": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "passagens": {
                                    "type": "integer"
                                },
                                "media_segundos": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "maximo_segundos": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "acima_do_alvo": {
                                    "type": "boolean"
                                },
                                "em_curso": {
                                    "type": "integer"
                                },
                                "em_curso_media_segundos": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "pessoas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "cor": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "passagens": {
                                    "type": "integer"
                                },
                                "media_segundos": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "fases": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "fase_id": {
                                                "type": "integer"
                                            },
                                            "passagens": {
                                                "type": "integer"
                                            },
                                            "media_segundos": {
                                                "type": "integer"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "total": {
                        "type": "object",
                        "properties": {
                            "passagens": {
                                "type": "integer"
                            },
                            "media_segundos": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "ciclo_medio_segundos": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            },
            "MktCartaoIntegracao": {
                "type": "object",
                "properties": {
                    "chave": {
                        "type": "string",
                        "enum": [
                            "meta_leads",
                            "google_leads",
                            "meta_mensagens",
                            "whatsapp_linhas",
                            "conversoes_meta",
                            "conversoes_google",
                            "custos_meta",
                            "custos_google",
                            "publicos",
                            "datas_especiais",
                            "sinc_email",
                            "aberturas"
                        ]
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "descricao": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "ok",
                            "pronto",
                            "por_configurar",
                            "erro",
                            "desligado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "falta": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "definicoes": {
                        "type": "string"
                    },
                    "ultimo_ok_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "ultimo_erro": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ultimo_erro_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "contagem": {
                        "type": "integer"
                    },
                    "acoes": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "MktIntegracoes": {
                "type": "object",
                "description": "«Channels and integrations» panel. No personal data or keys.",
                "properties": {
                    "cartoes": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/MktCartaoIntegracao"
                        }
                    },
                    "enderecos": {
                        "type": "object",
                        "properties": {
                            "meta": {
                                "type": "string"
                            },
                            "google_leads": {
                                "type": "string"
                            }
                        }
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "departamento": {
                                    "type": "string"
                                },
                                "numero": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "principal": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "leads_recentes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "plataforma": {
                                    "type": "string"
                                },
                                "plataforma_rotulo": {
                                    "type": "string"
                                },
                                "estado": {
                                    "type": "string"
                                },
                                "estado_rotulo": {
                                    "type": "string"
                                },
                                "erro": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "campanha": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "anuncio": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "teste": {
                                    "type": "boolean"
                                },
                                "tentativas": {
                                    "type": "integer"
                                },
                                "lead_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "recebido_em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                }
                            }
                        }
                    },
                    "conversoes": {
                        "type": "object",
                        "properties": {
                            "pendentes": {
                                "type": "integer"
                            },
                            "enviadas": {
                                "type": "integer"
                            },
                            "bloqueadas": {
                                "type": "integer"
                            },
                            "falhadas": {
                                "type": "integer"
                            },
                            "recentes": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "publicos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "datas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "pode_editar": {
                        "type": "boolean"
                    },
                    "pode_definicoes": {
                        "type": "boolean"
                    },
                    "acoes": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "CrmMenuVozArvore": {
                "type": "object",
                "description": "Menu tree: up to 40 steps; each step says a message (spoken or recorded, per language) and offers up to 12 options by key and/or words.",
                "properties": {
                    "inicio": {
                        "type": "string"
                    },
                    "nos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "string",
                                    "pattern": "^[a-z0-9_]{1,40}$"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "mensagem": {
                                    "type": "object",
                                    "properties": {
                                        "modo": {
                                            "type": "string",
                                            "enum": [
                                                "falada",
                                                "gravada"
                                            ]
                                        },
                                        "textos": {
                                            "type": "object"
                                        },
                                        "gravacoes": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "opcoes": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "tecla": {
                                                "type": "string"
                                            },
                                            "palavras": {
                                                "type": "array",
                                                "items": {
                                                    "type": "string"
                                                }
                                            },
                                            "rotulo": {
                                                "type": "string"
                                            },
                                            "destino": {
                                                "type": "object"
                                            }
                                        }
                                    }
                                },
                                "sem_resposta": {
                                    "type": [
                                        "object",
                                        "null"
                                    ]
                                },
                                "tentativas": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 5
                                },
                                "espera_s": {
                                    "type": "integer",
                                    "minimum": 3,
                                    "maximum": 20
                                }
                            }
                        }
                    }
                }
            },
            "CrmMenuVozEditor": {
                "type": "object",
                "properties": {
                    "menu": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "descricao": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "ativo": {
                                "type": "boolean"
                            },
                            "predefinido": {
                                "type": "boolean"
                            },
                            "lingua": {
                                "type": "string",
                                "enum": [
                                    "pt-PT",
                                    "pt-BR",
                                    "en",
                                    "es",
                                    "fr",
                                    "de"
                                ]
                            },
                            "usar_horario_clinica": {
                                "type": "boolean"
                            },
                            "horario": {
                                "type": "object",
                                "description": "{\"1\": [[\"09:00\",\"13:00\"], …], …, \"7\": []} (1 = Monday)."
                            },
                            "feriados": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "format": "date"
                                        },
                                        "nome": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "fora_horas": {
                                "type": "object"
                            },
                            "feriado": {
                                "type": "object"
                            },
                            "reconhecido": {
                                "type": "string",
                                "enum": [
                                    "menu",
                                    "gestor",
                                    "agente"
                                ]
                            },
                            "aviso_gravacao": {
                                "type": "boolean"
                            },
                            "versao": {
                                "type": "integer"
                            },
                            "publicado_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "atualizado_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            }
                        }
                    },
                    "arvore": {
                        "$ref": "#/components/schemas/CrmMenuVozArvore"
                    },
                    "avisos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "momento": {
                        "type": "string",
                        "enum": [
                            "aberto",
                            "fora_horas",
                            "feriado"
                        ]
                    },
                    "momento_rotulo": {
                        "type": "string"
                    },
                    "numeros": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "numero": {
                                    "type": "string"
                                },
                                "nome": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "opcoes": {
                        "type": "object",
                        "properties": {
                            "destinos": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "departamentos": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "linguas": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "reconhecido": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "teclas": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "gravacoes": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "pode_editar": {
                        "type": "boolean"
                    }
                }
            },
            "CrmVozesLinguas": {
                "type": "object",
                "properties": {
                    "variante_pt": {
                        "type": "string",
                        "enum": [
                            "pt-PT",
                            "acompanhar"
                        ]
                    },
                    "lingua_omissao": {
                        "type": "string"
                    },
                    "ouvir_pronto": {
                        "type": "boolean"
                    },
                    "pt_pt_ok": {
                        "type": "boolean"
                    },
                    "linguas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "lingua": {
                                    "type": "string",
                                    "enum": [
                                        "pt-PT",
                                        "pt-BR",
                                        "en",
                                        "es",
                                        "fr",
                                        "de"
                                    ]
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "ativa": {
                                    "type": "boolean"
                                },
                                "ouvir": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "enum": [
                                        "local",
                                        "externo",
                                        null
                                    ]
                                },
                                "falar": {
                                    "type": "string",
                                    "enum": [
                                        "local",
                                        "externo",
                                        "ponte"
                                    ]
                                },
                                "falar_rotulo": {
                                    "type": "string"
                                },
                                "voz": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "voz_exata": {
                                    "type": "boolean"
                                },
                                "avisos": {
                                    "type": "array",
                                    "items": {
                                        "type": "string",
                                        "enum": [
                                            "sem_voz",
                                            "voz_de_outra_variante",
                                            "voz_brasileira",
                                            "voz_europeia",
                                            "variante_por_confirmar",
                                            "local_sem_pt_pt",
                                            "local_pt_generico",
                                            "fala_da_central"
                                        ]
                                    }
                                },
                                "avisos_rotulos": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "ultimo_teste": {
                                    "type": [
                                        "object",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                }
            },
            "CrmExecucaoTestes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pendente",
                            "a_correr",
                            "concluida",
                            "falhou"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "total": {
                        "type": "integer"
                    },
                    "feitos": {
                        "type": "integer"
                    },
                    "passaram": {
                        "type": "integer"
                    },
                    "falharam": {
                        "type": "integer"
                    },
                    "regrediram": {
                        "type": "integer"
                    },
                    "melhoraram": {
                        "type": "integer"
                    },
                    "artigos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "versao_testada": {
                                    "type": "integer"
                                },
                                "versao": {
                                    "type": "integer"
                                },
                                "estado": {
                                    "type": "string"
                                },
                                "clinico": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "regras": {
                        "type": "object",
                        "properties": {
                            "temas_proibidos": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "alarmes": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "decisao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "aprovada",
                            "rejeitada",
                            null
                        ]
                    },
                    "decisao_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "decidido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "nota": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "publicado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "concluida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "pode_decidir": {
                        "type": "boolean"
                    },
                    "resultados": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "description": "Detail only; regressions first. No personal data (test conversations are cleaned).",
                            "properties": {
                                "teste_id": {
                                    "type": "integer"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "canal": {
                                    "type": "string",
                                    "enum": [
                                        "voz",
                                        "escrito"
                                    ]
                                },
                                "pergunta": {
                                    "type": "string"
                                },
                                "resposta_atual": {
                                    "type": "string"
                                },
                                "resposta_nova": {
                                    "type": "string"
                                },
                                "passou_atual": {
                                    "type": "boolean"
                                },
                                "passou_nova": {
                                    "type": "boolean"
                                },
                                "falhas_atual_rotulos": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "falhas_nova_rotulos": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "regrediu": {
                                    "type": "boolean"
                                },
                                "melhorou": {
                                    "type": "boolean"
                                },
                                "diferente": {
                                    "type": "boolean"
                                },
                                "semelhanca": {
                                    "type": "integer",
                                    "x-unidade": "%"
                                }
                            }
                        }
                    }
                }
            },
            "CrmChamadaAoVivo": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "direcao": {
                        "type": "string",
                        "enum": [
                            "entrada",
                            "saida"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "a_tocar",
                            "em_curso"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "numero_clinica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "numero_campanha": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "extensao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "pessoa": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "tipo": {
                                "type": "string",
                                "enum": [
                                    "paciente",
                                    "lead"
                                ]
                            },
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            }
                        }
                    },
                    "responsavel": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "cor": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "atendente": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "cor": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "tarefas_abertas": {
                        "type": "integer"
                    },
                    "ultimo_contacto": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "inicio": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "direcao": {
                                "type": "string"
                            },
                            "estado_rotulo": {
                                "type": "string"
                            }
                        }
                    },
                    "pelo_agente": {
                        "type": "boolean"
                    }
                }
            },
            "Bloco": {
                "type": "object",
                "required": [
                    "tipo"
                ],
                "description": "Single-format block (§18.1): kpis, lista, campos, grafico, galeria, cronologia, alerta, jornada, acoes. Link L = {web, app}.",
                "properties": {
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "kpis",
                            "lista",
                            "campos",
                            "grafico",
                            "galeria",
                            "cronologia",
                            "alerta",
                            "jornada",
                            "acoes"
                        ]
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "itens": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "grafico": {
                        "type": "string",
                        "enum": [
                            "linha",
                            "area",
                            "barras",
                            "barras-h",
                            "donut",
                            "funil",
                            "calor",
                            "dispersao"
                        ]
                    },
                    "valores": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "number"
                                },
                                "serie": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "rotulo": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "unidade": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tom": {
                        "type": "string",
                        "enum": [
                            "marca",
                            "ouro",
                            "sucesso",
                            "aviso",
                            "perigo",
                            "info",
                            "neutro",
                            "dadora"
                        ]
                    },
                    "texto": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "etapa": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9
                    },
                    "ligacao": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "web": {
                                "type": "string"
                            },
                            "app": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "CartaoPainel": {
                "type": "object",
                "properties": {
                    "chave": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "icone": {
                        "type": "string"
                    },
                    "ordem": {
                        "type": "integer"
                    },
                    "largura": {
                        "type": "integer",
                        "enum": [
                            1,
                            2,
                            3
                        ]
                    },
                    "oculto": {
                        "type": "boolean"
                    },
                    "erro": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "blocos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Bloco"
                        }
                    }
                }
            },
            "PreferenciasPainel": {
                "type": "object",
                "properties": {
                    "ordem": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "ocultos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "larguras": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3
                        }
                    },
                    "periodo": {
                        "type": "string",
                        "enum": [
                            "hoje",
                            "semana",
                            "mes",
                            "30d",
                            "trimestre",
                            "ano"
                        ]
                    }
                }
            },
            "Painel": {
                "type": "object",
                "properties": {
                    "periodo": {
                        "type": "object",
                        "properties": {
                            "chave": {
                                "type": "string"
                            },
                            "de": {
                                "type": "string",
                                "format": "date"
                            },
                            "ate": {
                                "type": "string",
                                "format": "date"
                            },
                            "rotulo": {
                                "type": "string"
                            }
                        }
                    },
                    "saudacao": {
                        "type": "string"
                    },
                    "preferencias": {
                        "$ref": "#/components/schemas/PreferenciasPainel"
                    },
                    "periodos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "blocos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/CartaoPainel"
                        }
                    }
                }
            },
            "ItemChecklist": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "texto": {
                        "type": "string"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "responsavel_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "obrigatorio": {
                        "type": "boolean"
                    },
                    "feito": {
                        "type": "boolean"
                    },
                    "feito_por_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "feito_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "ordem": {
                        "type": "integer"
                    }
                }
            },
            "Tarefa": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "prioridade": {
                        "type": "string",
                        "enum": [
                            "baixa",
                            "normal",
                            "alta",
                            "urgente"
                        ]
                    },
                    "prioridade_rotulo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "aberta",
                            "em_curso",
                            "concluida",
                            "cancelada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "origem": {
                        "type": "string",
                        "enum": [
                            "manual",
                            "automatica",
                            "mensagem",
                            "agente"
                        ]
                    },
                    "origem_rotulo": {
                        "type": "string"
                    },
                    "ref_tipo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ref_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "prazo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "em_atraso": {
                        "type": "boolean"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "responsavel_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "departamento_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "paciente_nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "x-anagen-permissao": "ficha.identificacao"
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "lead_nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "x-anagen-permissao": "crm.leads"
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "cirurgia_numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "x-anagen-permissao": "bloco.mapa"
                    },
                    "checklist": {
                        "type": "object",
                        "properties": {
                            "total": {
                                "type": "integer"
                            },
                            "feitos": {
                                "type": "integer"
                            }
                        }
                    },
                    "itens": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ItemChecklist"
                        }
                    },
                    "concluida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "NovaTarefa": {
                "type": "object",
                "required": [
                    "titulo"
                ],
                "properties": {
                    "titulo": {
                        "type": "string",
                        "maxLength": 255,
                        "description": "Accepts !priority, hoje/amanhã and @Name."
                    },
                    "descricao": {
                        "type": "string",
                        "maxLength": 5000
                    },
                    "prazo": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "prioridade": {
                        "type": "string",
                        "enum": [
                            "baixa",
                            "normal",
                            "alta",
                            "urgente"
                        ]
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao",
                            null
                        ]
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "itens": {
                        "type": "array",
                        "maxItems": 50,
                        "items": {
                            "type": "string",
                            "maxLength": 255
                        },
                        "description": "Initial checklist items."
                    }
                }
            },
            "AlterarTarefa": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": "string",
                        "maxLength": 255
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "prazo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "prioridade": {
                        "type": "string",
                        "enum": [
                            "baixa",
                            "normal",
                            "alta",
                            "urgente"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "aberta",
                            "em_curso",
                            "cancelada"
                        ]
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    }
                }
            },
            "ListaTarefas": {
                "type": "object",
                "properties": {
                    "vista": {
                        "type": "string"
                    },
                    "grupos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "tom": {
                                    "type": "string"
                                },
                                "tarefas": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/Tarefa"
                                    }
                                }
                            }
                        }
                    },
                    "total": {
                        "type": "integer"
                    },
                    "contagens": {
                        "type": "object",
                        "properties": {
                            "hoje": {
                                "type": "integer"
                            },
                            "atraso": {
                                "type": "integer"
                            },
                            "abertas": {
                                "type": "integer"
                            },
                            "equipa": {
                                "type": "integer"
                            }
                        }
                    }
                }
            },
            "Canal": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "privado",
                            "grupo",
                            "departamento",
                            "paciente",
                            "cirurgia"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "arquivado": {
                        "type": "boolean"
                    },
                    "silenciado": {
                        "type": "boolean"
                    },
                    "convidado_externo": {
                        "type": "boolean"
                    },
                    "gestor": {
                        "type": "boolean"
                    },
                    "nao_lidas": {
                        "type": "integer"
                    },
                    "mencoes": {
                        "type": "integer"
                    },
                    "ultima": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "texto": {
                                "type": "string"
                            },
                            "autor_nome": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            }
                        }
                    },
                    "ultima_mensagem_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "CanalDetalhe": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "arquivado": {
                        "type": "boolean"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "ligacao": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "web": {
                                "type": "string"
                            },
                            "app": {
                                "type": "string"
                            }
                        }
                    },
                    "gestor": {
                        "type": "boolean"
                    },
                    "silenciado": {
                        "type": "boolean"
                    },
                    "pode_escrever": {
                        "type": "boolean"
                    },
                    "atualizar_segundos": {
                        "type": "integer"
                    },
                    "membros": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "cor": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "foto_ficheiro_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "perfil": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "papel": {
                                    "type": "string",
                                    "enum": [
                                        "membro",
                                        "gestor"
                                    ]
                                },
                                "ultimo_lido_id": {
                                    "type": "integer"
                                },
                                "lido_em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "convidado_externo": {
                                    "type": "boolean"
                                }
                            }
                        }
                    }
                }
            },
            "NovoCanal": {
                "type": "object",
                "required": [
                    "tipo"
                ],
                "properties": {
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "grupo",
                            "paciente",
                            "cirurgia",
                            "departamento"
                        ]
                    },
                    "nome": {
                        "type": "string",
                        "maxLength": 120
                    },
                    "descricao": {
                        "type": "string",
                        "maxLength": 500
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "membros": {
                        "type": "array",
                        "items": {
                            "type": "integer"
                        }
                    }
                }
            },
            "Mensagem": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "canal_id": {
                        "type": "integer"
                    },
                    "autor_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "autor_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "autor_cor": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "minha": {
                        "type": "boolean"
                    },
                    "sistema": {
                        "type": "boolean"
                    },
                    "corpo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "apagada": {
                        "type": "boolean"
                    },
                    "editada": {
                        "type": "boolean"
                    },
                    "mencoes": {
                        "type": "array",
                        "items": {
                            "type": "integer"
                        }
                    },
                    "mencionado": {
                        "type": "boolean"
                    },
                    "anexos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "mime": {
                                    "type": "string"
                                },
                                "tamanho": {
                                    "type": "integer",
                                    "x-unidade": "bytes"
                                },
                                "tipo": {
                                    "type": "string"
                                },
                                "url": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "description": "Signed link (30 min)."
                                }
                            }
                        }
                    },
                    "tarefa_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "responde_a_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "lido_por": {
                        "type": "integer"
                    },
                    "lido_por_todos": {
                        "type": "boolean"
                    },
                    "pode_editar": {
                        "type": "boolean"
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "MensagensDoCanal": {
                "type": "object",
                "properties": {
                    "mensagens": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Mensagem"
                        }
                    },
                    "leituras": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "integer"
                        },
                        "description": "User → last read id."
                    },
                    "ha_mais": {
                        "type": "boolean"
                    }
                }
            },
            "Comunicado": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "corpo": {
                        "type": "string",
                        "description": "Sanitised HTML."
                    },
                    "resumo": {
                        "type": "string"
                    },
                    "publico": {
                        "type": "string",
                        "enum": [
                            "todos",
                            "departamento",
                            "perfil"
                        ]
                    },
                    "publico_rotulo": {
                        "type": "string"
                    },
                    "destino": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "destino_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "importancia": {
                        "type": "string",
                        "enum": [
                            "normal",
                            "alta"
                        ]
                    },
                    "exige_leitura": {
                        "type": "boolean"
                    },
                    "fixado": {
                        "type": "boolean"
                    },
                    "publicado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "lido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "por_ler": {
                        "type": "boolean"
                    },
                    "estatisticas": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "lidos": {
                                "type": "integer"
                            },
                            "total": {
                                "type": "integer"
                            }
                        }
                    }
                }
            },
            "GruposDeIndicadores": {
                "type": "object",
                "properties": {
                    "grupos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "icone": {
                                    "type": "string"
                                },
                                "modulo": {
                                    "type": "string"
                                },
                                "exportar": {
                                    "type": "boolean"
                                },
                                "indicadores": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "chave": {
                                                "type": "string"
                                            },
                                            "titulo": {
                                                "type": "string"
                                            },
                                            "descricao": {
                                                "type": "string"
                                            },
                                            "icone": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "filtros": {
                        "type": "object"
                    },
                    "consolidar": {
                        "type": "boolean"
                    }
                }
            },
            "ResultadoIndicadores": {
                "type": "object",
                "properties": {
                    "grupo": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "filtros": {
                        "type": "object",
                        "properties": {
                            "periodo": {
                                "type": "string"
                            },
                            "de": {
                                "type": "string"
                            },
                            "ate": {
                                "type": "string"
                            },
                            "ant_de": {
                                "type": "string"
                            },
                            "ant_ate": {
                                "type": "string"
                            },
                            "medico_id": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "comercial_id": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "origem": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "procedimento_id": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "todas": {
                                "type": "boolean"
                            }
                        }
                    },
                    "ativos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "indicadores": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "grupo": {
                                    "type": "string"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "descricao": {
                                    "type": "string"
                                },
                                "icone": {
                                    "type": "string"
                                },
                                "disponivel": {
                                    "type": "boolean"
                                },
                                "falta": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "blocos": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/Bloco"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "TokenBi": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "prefixo": {
                        "type": "string"
                    },
                    "conjuntos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "ultimo_uso_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "usos": {
                        "type": "integer"
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "revogado": {
                        "type": "boolean"
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "Exportacao": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pedido",
                            "a_gerar",
                            "concluida",
                            "erro",
                            "expirada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "pedido_por_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tamanho": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "bytes"
                    },
                    "tabelas": {
                        "type": "integer"
                    },
                    "sha256": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "erro": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "concluida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "descarregar": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Signed link (15 min, requires a web session)."
                    }
                }
            },
            "ConsumoIntegracoes": {
                "type": "object",
                "properties": {
                    "dias": {
                        "type": "integer"
                    },
                    "fonte": {
                        "type": "string",
                        "enum": [
                            "atividade",
                            "tokens"
                        ]
                    },
                    "clientes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "client_id": {
                                    "type": "string"
                                },
                                "ativo": {
                                    "type": "boolean"
                                },
                                "limite_minuto": {
                                    "type": "integer"
                                },
                                "ultimo_uso_em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "pedidos": {
                                    "type": "integer"
                                },
                                "erros": {
                                    "type": "integer"
                                },
                                "tokens": {
                                    "type": "integer"
                                },
                                "ms_medio": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "x-unidade": "ms"
                                }
                            }
                        }
                    },
                    "blocos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Bloco"
                        }
                    }
                }
            },
            "SessaoReuniao": {
                "type": "object",
                "description": "State of a recorded meeting (without transcript text).",
                "properties": {
                    "reuniao": {
                        "type": "object"
                    },
                    "participantes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "presencas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "meu_consentimento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "dado",
                            "recusado",
                            "retirado",
                            null
                        ]
                    },
                    "gravacao": {
                        "type": "object"
                    },
                    "transcricao": {
                        "type": "object"
                    },
                    "resumo": {
                        "type": "object"
                    },
                    "acoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "assistente": {
                        "type": "object"
                    },
                    "permissoes": {
                        "type": "object"
                    }
                }
            },
            "CursoAcademia": {
                "type": "object",
                "properties": {
                    "curso": {
                        "type": "object"
                    },
                    "licoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "progresso": {
                        "type": "object"
                    },
                    "teste": {
                        "type": "object",
                        "properties": {
                            "perguntas": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "enunciado": {
                                            "type": "string"
                                        },
                                        "tipo": {
                                            "type": "string",
                                            "enum": [
                                                "unica",
                                                "multipla",
                                                "verdadeiro_falso"
                                            ]
                                        },
                                        "opcoes": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "indice": {
                                                        "type": "integer"
                                                    },
                                                    "texto": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                            "disponivel": {
                                "type": "boolean"
                            },
                            "falta_licoes": {
                                "type": "boolean"
                            },
                            "tentativas": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "certificado": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "gerir": {
                        "type": "boolean"
                    }
                }
            },
            "Incorporacao3d": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "modelo3d_id": {
                        "type": "integer"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Creation only."
                    },
                    "codigo_incorporacao": {
                        "type": "string",
                        "description": "Ready-to-paste iframe. Creation only."
                    },
                    "origens": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "referencia": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "expira_em": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "ativa",
                            "expirada",
                            "revogada"
                        ]
                    },
                    "vistas": {
                        "type": "integer"
                    },
                    "ultimo_acesso_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "minutos": {
                        "type": "integer"
                    },
                    "sem_rosto": {
                        "type": "boolean"
                    }
                }
            },
            "Licenca": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "chave": {
                        "type": "string"
                    },
                    "chave_mascarada": {
                        "type": "string"
                    },
                    "clinica": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "codigo": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "localidade": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "logotipo_url": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "cor_marca": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "ativa": {
                                "type": "boolean"
                            }
                        }
                    },
                    "plano": {
                        "type": "string",
                        "enum": [
                            "essencial",
                            "clinica",
                            "grupo",
                            "personalizado"
                        ]
                    },
                    "plano_rotulo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "teste",
                            "ativa",
                            "suspensa",
                            "expirada",
                            "cancelada"
                        ]
                    },
                    "estado_efetivo": {
                        "type": "string",
                        "enum": [
                            "teste",
                            "ativa",
                            "graca",
                            "expirada",
                            "suspensa",
                            "cancelada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "tom": {
                        "type": "string"
                    },
                    "so_leitura": {
                        "type": "boolean"
                    },
                    "bloqueada": {
                        "type": "boolean"
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "dias_restantes": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "dias_graca": {
                        "type": "integer"
                    },
                    "dias_graca_restantes": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "renovacao_automatica": {
                        "type": "boolean"
                    },
                    "modulos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "modulos_total": {
                        "type": "integer"
                    },
                    "limites": {
                        "type": "object",
                        "properties": {
                            "utilizadores": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "armazenamento_gb": {
                                "type": [
                                    "number",
                                    "null"
                                ],
                                "x-unidade": "GB"
                            },
                            "locais": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            }
                        }
                    },
                    "uso": {
                        "type": "object",
                        "properties": {
                            "utilizadores": {
                                "type": "integer"
                            },
                            "armazenamento_bytes": {
                                "type": "integer"
                            },
                            "armazenamento_gb": {
                                "type": "number",
                                "x-unidade": "GB"
                            },
                            "locais": {
                                "type": "integer"
                            }
                        }
                    },
                    "percentagens": {
                        "type": "object"
                    },
                    "preco": {
                        "type": "number"
                    },
                    "periodicidade": {
                        "type": "string"
                    },
                    "moeda": {
                        "type": "string"
                    },
                    "mrr": {
                        "type": "number"
                    },
                    "faturacao": {
                        "type": "object"
                    },
                    "responsavel": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "administrador": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "suspensa_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "motivo_suspensao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "cancelada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "dominios": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Dominio"
                        }
                    },
                    "eventos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/EventoLicenca"
                        }
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "atualizado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "EventoLicenca": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "tom": {
                        "type": "string"
                    },
                    "ator_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "resumo": {
                        "type": "string"
                    },
                    "antes": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "depois": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "Dominio": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "clinica_id": {
                        "type": "integer"
                    },
                    "dominio": {
                        "type": "string"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "site",
                            "portal",
                            "ambos"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "principal": {
                        "type": "boolean"
                    },
                    "subdominio": {
                        "type": "boolean"
                    },
                    "verificado": {
                        "type": "boolean"
                    },
                    "verificado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "registo_dns": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "tipo": {
                                "type": "string"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "valor": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "ResumoLicencas": {
                "type": "object",
                "properties": {
                    "kpis": {
                        "type": "object"
                    },
                    "por_estado": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "por_plano": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "mrr_por_mes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "a_expirar": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Licenca"
                        }
                    },
                    "sem_licenca": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "PedidoNovaLicenca": {
                "type": "object",
                "required": [
                    "marca",
                    "licenca",
                    "administrador"
                ],
                "properties": {
                    "clinica_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "clinica": {
                        "type": "object"
                    },
                    "marca": {
                        "type": "object"
                    },
                    "licenca": {
                        "type": "object"
                    },
                    "administrador": {
                        "type": "object",
                        "properties": {
                            "nome": {
                                "type": "string"
                            },
                            "email": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "PreparacaoModulo": {
                "type": "object",
                "properties": {
                    "modulo": {
                        "type": "string"
                    },
                    "ordem": {
                        "type": "integer"
                    },
                    "ok": {
                        "type": "boolean"
                    },
                    "criados": {
                        "type": "integer"
                    },
                    "mensagens": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "erro": {
                        "type": "string"
                    }
                }
            },
            "ResultadoNovaLicenca": {
                "type": "object",
                "properties": {
                    "licenca": {
                        "$ref": "#/components/schemas/Licenca"
                    },
                    "clinica": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "codigo": {
                                "type": "string"
                            }
                        }
                    },
                    "preparacao": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/PreparacaoModulo"
                        }
                    },
                    "administrador": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "email": {
                                "type": "string"
                            },
                            "convite_enviado": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            },
            "MinhaLicenca": {
                "type": "object",
                "properties": {
                    "clinica": {
                        "type": "object"
                    },
                    "plataforma": {
                        "type": "boolean"
                    },
                    "licenca": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "modulos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "uso": {
                        "type": "object"
                    },
                    "contacto": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "eventos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "EstadoLicenca": {
                "type": "object",
                "properties": {
                    "estado": {
                        "type": "string",
                        "enum": [
                            "teste",
                            "ativa",
                            "graca",
                            "expirada",
                            "suspensa",
                            "cancelada",
                            "sem_licenca",
                            "plataforma"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "tom": {
                        "type": "string"
                    },
                    "so_leitura": {
                        "type": "boolean"
                    },
                    "bloqueada": {
                        "type": "boolean"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "dias_restantes": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "dias_graca": {
                        "type": "integer"
                    },
                    "dias_graca_restantes": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "aviso": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "tom": {
                                "type": "string"
                            },
                            "titulo": {
                                "type": "string"
                            },
                            "texto": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "Superadmin": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "idioma": {
                        "type": "string"
                    },
                    "clinica": {
                        "type": "object"
                    },
                    "perfil": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "so_plataforma": {
                        "type": "boolean"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "ativo",
                            "suspenso",
                            "convidado",
                            "bloqueado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "tom": {
                        "type": "string"
                    },
                    "segundo_fator": {
                        "type": "boolean"
                    },
                    "ultimo_acesso_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "sessoes_ativas": {
                        "type": "integer"
                    },
                    "superadmin_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "eu": {
                        "type": "boolean"
                    },
                    "pode": {
                        "type": "object"
                    },
                    "historico": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "ClinicaPublica": {
                "type": "object",
                "properties": {
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "nome": {
                        "type": "string"
                    },
                    "localidade": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "logotipo_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "cor_marca": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "disponivel": {
                        "type": "boolean"
                    },
                    "mensagem": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "ResultadoEmailTeste": {
                "type": "object",
                "properties": {
                    "ok": {
                        "type": "boolean"
                    },
                    "categoria": {
                        "type": "string",
                        "enum": [
                            "ok",
                            "incompleto",
                            "ligacao",
                            "autenticacao",
                            "cifra",
                            "remetente",
                            "tempo",
                            "outro"
                        ]
                    },
                    "mensagem": {
                        "type": "string"
                    },
                    "servidor": {
                        "type": "string"
                    },
                    "porta": {
                        "type": "integer"
                    },
                    "cifra": {
                        "type": "string"
                    },
                    "remetente": {
                        "type": "string"
                    },
                    "utilizador": {
                        "type": "string"
                    }
                }
            },
            "AmbienteExecucao": {
                "type": "object",
                "properties": {
                    "ambiente": {
                        "type": "string",
                        "enum": [
                            "producao",
                            "testes",
                            "desenvolvimento"
                        ]
                    },
                    "producao": {
                        "type": "boolean"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "texto": {
                        "type": "string"
                    },
                    "tom": {
                        "type": "string"
                    },
                    "canais": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "canal": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "permitido": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "canais_permitidos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "destinos_restritos": {
                        "type": "boolean"
                    },
                    "dados": {
                        "type": "object",
                        "properties": {
                            "tipo": {
                                "type": "string",
                                "enum": [
                                    "producao",
                                    "sinteticos",
                                    "anonimizados",
                                    "desconhecida"
                                ]
                            },
                            "rotulo": {
                                "type": "string"
                            },
                            "em": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "aviso": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            },
            "EstadoPlataforma": {
                "type": "object",
                "properties": {
                    "gerado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "semaforo": {
                        "type": "object",
                        "properties": {
                            "tom": {
                                "type": "string",
                                "enum": [
                                    "sucesso",
                                    "aviso",
                                    "perigo"
                                ]
                            },
                            "titulo": {
                                "type": "string"
                            },
                            "texto": {
                                "type": "string"
                            }
                        }
                    },
                    "pontos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "tom": {
                                    "type": "string"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "texto": {
                                    "type": "string"
                                },
                                "seccao": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "ambiente": {
                        "$ref": "#/components/schemas/AmbienteExecucao"
                    },
                    "copias": {
                        "type": "object",
                        "description": "ativo, hora, proxima_em, ultima, ultima_tentativa, horas_desde, atraso, atraso_horas, por_tipo, retencao, espaco_local(_legivel), falhadas_30d, sem_destino_7d, pendente, serie [{x, dia, y (MB), serie, estado}], recentes, metodo_dump, destino {tipo, rotulo, configurado, imutavel, disponivel, retido}"
                    },
                    "restauros": {
                        "type": "object",
                        "description": "configurado, intervalo_dias, ultimo, ultimo_ok, dias_desde, atraso, pendente, recentes"
                    },
                    "vulnerabilidades": {
                        "type": "object",
                        "description": "abertas, por_gravidade, fora_prazo, lista, prazos, intrusao {ultimo, meses, atraso}, exercicio {ultimo, atraso}, atividades"
                    },
                    "dependencias": {
                        "type": "object",
                        "description": "servidor and app: {em, dias_desde, pacotes, vulneraveis, desatualizados, atraso} or null; inventario_servidor; composer"
                    },
                    "alojamento": {
                        "type": "object",
                        "description": "principal, copias, subcontratantes […], tudo_ue, alojamento_ue, avisos, ia {ativos, com_dados, usos}"
                    },
                    "security_txt": {
                        "type": "object",
                        "properties": {
                            "ativo": {
                                "type": "boolean"
                            },
                            "url": {
                                "type": "string"
                            },
                            "contactos": {
                                "type": "integer"
                            },
                            "expira_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date"
                            },
                            "dias": {
                                "type": "integer"
                            },
                            "declarada": {
                                "type": "boolean"
                            },
                            "problemas": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "tom": {
                                "type": "string"
                            }
                        }
                    },
                    "versao": {
                        "type": "object",
                        "properties": {
                            "plataforma": {
                                "type": "string"
                            },
                            "execucao": {
                                "type": "string"
                            },
                            "base_dados": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "cifra": {
                                "type": "object",
                                "properties": {
                                    "geral": {
                                        "type": "boolean"
                                    },
                                    "clinico": {
                                        "type": "boolean"
                                    },
                                    "distintas": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "capacidades": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "chave": {
                                            "type": "string"
                                        },
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "rotulo": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "opcoes": {
                        "type": "object",
                        "description": "Lists {valor, rotulo}: gravidades, estados, origens, superficies, tipos, resultados."
                    }
                }
            },
            "CopiaSeguranca": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "origem": {
                        "type": "string",
                        "enum": [
                            "automatica",
                            "pedido",
                            "comando"
                        ]
                    },
                    "origem_rotulo": {
                        "type": "string"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "diaria",
                            "semanal",
                            "mensal",
                            "manual"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pedida",
                            "em_curso",
                            "ok",
                            "erro"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "estado_tom": {
                        "type": "string"
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pedida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "iniciada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "terminada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "duracao_ms": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "duracao_legivel": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tamanho": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "tamanho_legivel": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tamanho_conteudo": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "sha256": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[0-9a-f]{64}$"
                    },
                    "sha256_conteudo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "metodo_dump": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "binario",
                            "php",
                            null
                        ]
                    },
                    "metodo_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "base_dados": {
                        "type": "object",
                        "properties": {
                            "tabelas": {
                                "type": "integer"
                            },
                            "linhas": {
                                "type": "integer"
                            },
                            "bytes": {
                                "type": "integer"
                            }
                        }
                    },
                    "ficheiros": {
                        "type": "object",
                        "properties": {
                            "total": {
                                "type": "integer"
                            },
                            "bytes": {
                                "type": "integer"
                            },
                            "bytes_legiveis": {
                                "type": "string"
                            }
                        }
                    },
                    "local": {
                        "type": "boolean"
                    },
                    "local_removida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "verificada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "verificacao_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "ok",
                            "falhou",
                            null
                        ]
                    },
                    "verificacao_tom": {
                        "type": "string"
                    },
                    "verificacao_detalhe": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "verificacao_pedida": {
                        "type": "boolean"
                    },
                    "destino_tipo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "destino_rotulo": {
                        "type": "string"
                    },
                    "destino_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "nao_aplicavel",
                            "por_enviar",
                            "enviada",
                            "falhou",
                            "retida",
                            null
                        ]
                    },
                    "destino_estado_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "destino_tom": {
                        "type": "string"
                    },
                    "destino_enviada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "destino_detalhe": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "destino_tentativas": {
                        "type": "integer"
                    },
                    "imutavel": {
                        "type": "boolean"
                    },
                    "retencao_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "restauro_testado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "restauro_estado": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "erro": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ligacao": {
                        "type": "object",
                        "properties": {
                            "web": {
                                "type": "string"
                            },
                            "app": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "TesteRestauro": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "copia_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "teste",
                            "restauro"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "origem": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pedido",
                            "em_curso",
                            "ok",
                            "parcial",
                            "erro"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "estado_tom": {
                        "type": "string"
                    },
                    "esquema": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "metodo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pedido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "iniciado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "terminado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "duracao_legivel": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tabelas_esperadas": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "tabelas_restauradas": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "linhas_esperadas": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "linhas_restauradas": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "ficheiros_verificados": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "ficheiros_falhados": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "falhas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "tabela": {
                                    "type": "string"
                                },
                                "esperadas": {
                                    "type": "integer"
                                },
                                "restauradas": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "toleradas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "tabela": {
                                    "type": "string"
                                },
                                "esperadas": {
                                    "type": "integer"
                                },
                                "restauradas": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "detalhe": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "erro": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "Vulnerabilidade": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "origem": {
                        "type": "string",
                        "enum": [
                            "composer_audit",
                            "pub_outdated",
                            "teste_intrusao",
                            "divulgacao",
                            "revisao_interna",
                            "asvs",
                            "outro"
                        ]
                    },
                    "origem_rotulo": {
                        "type": "string"
                    },
                    "superficie": {
                        "type": "string",
                        "enum": [
                            "servidor",
                            "app",
                            "infraestrutura",
                            "processo"
                        ]
                    },
                    "superficie_rotulo": {
                        "type": "string"
                    },
                    "referencia": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "componente": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "versao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "gravidade": {
                        "type": "string",
                        "enum": [
                            "critica",
                            "alta",
                            "media",
                            "baixa",
                            "info"
                        ]
                    },
                    "gravidade_rotulo": {
                        "type": "string"
                    },
                    "gravidade_tom": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "detetada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "prazo_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "dias_para_prazo": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "fora_prazo": {
                        "type": "boolean"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "aberta",
                            "em_correcao",
                            "corrigida",
                            "aceite",
                            "falso_positivo"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "estado_tom": {
                        "type": "string"
                    },
                    "resolvida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "atividade_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "automatica": {
                        "type": "boolean"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Detail only (stored encrypted)."
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Detail only (stored encrypted)."
                    }
                }
            },
            "AtividadeOperacao": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "teste_intrusao",
                            "exercicio_continuidade",
                            "teste_restauro_manual",
                            "revisao_dependencias",
                            "revisao_asvs",
                            "revisao_acessos",
                            "outro"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "realizada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "entidade": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ambito": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "resultado": {
                        "type": "string",
                        "enum": [
                            "sem_constatacoes",
                            "com_constatacoes",
                            "parcial",
                            "falhou",
                            "concluido"
                        ]
                    },
                    "resultado_rotulo": {
                        "type": "string"
                    },
                    "resultado_tom": {
                        "type": "string"
                    },
                    "resumo": {
                        "type": "object"
                    },
                    "rpo_minutos": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "rto_minutos": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "proxima_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "em_atraso": {
                        "type": "boolean"
                    }
                }
            },
            "PerfilParceiro": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "medico",
                            "clinica",
                            "outro"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "organizacao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "email": {
                        "type": "string"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "cedula": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "EncaminhamentoParceiro": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "codigo": {
                        "type": "string"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "contacto": {
                        "type": "object"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "recebido",
                            "em_contacto",
                            "avaliacao",
                            "concluido",
                            "sem_seguimento"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "autorizado": {
                        "type": "boolean",
                        "description": "The patient authorised sharing progress."
                    },
                    "recompensa": {
                        "type": "object",
                        "properties": {
                            "aplicavel": {
                                "type": "boolean"
                            },
                            "estado": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "pendente",
                                    "atribuida",
                                    null
                                ]
                            },
                            "rotulo": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "ValorComUnidade": {
                "type": "object",
                "required": [
                    "valor",
                    "unidade"
                ],
                "properties": {
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "unidade": {
                        "type": "string",
                        "enum": [
                            "UF/cm²",
                            "cabelos/cm²",
                            "enxertos",
                            "cm²",
                            "mm",
                            "mm²",
                            "cm",
                            "%",
                            "cabelos/UF",
                            "UF",
                            "cabelos",
                            "sessões",
                            "meses",
                            "anos",
                            "horas",
                            "mg/kg",
                            "—",
                            "pontos",
                            "campos",
                            "graus"
                        ]
                    }
                }
            },
            "NumeroMotor": {
                "type": "object",
                "description": "Engine number with unit, interval, formula, step-by-step, parameters and source.",
                "properties": {
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "unidade": {
                        "type": "string"
                    },
                    "min": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "max": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "formula": {
                        "type": "string"
                    },
                    "passos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "fonte": {
                        "type": "string"
                    },
                    "parametros": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "valor": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "unidade": {
                                    "type": "string"
                                },
                                "referencia": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "fonte": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                },
                "example": {
                    "valor": 5625,
                    "unidade": "enxertos",
                    "min": 5344,
                    "max": 5907,
                    "formula": "N = Σ G × (1 + margem)",
                    "passos": [
                        "Linha frontal: 15 cm² × 25 UF/cm² = 375 enxertos",
                        "…",
                        "Soma das zonas: 5 625 enxertos"
                    ],
                    "parametros": [
                        {
                            "chave": "margem",
                            "nome": "Margem",
                            "valor": 0,
                            "unidade": "%",
                            "referencia": null,
                            "fonte": "sem fonte primária"
                        }
                    ],
                    "fonte": "Análise de referências e funcionalidades, secção 5 (27/10/2026)"
                }
            },
            "Aviso": {
                "type": "object",
                "properties": {
                    "codigo": {
                        "type": "string"
                    },
                    "nivel": {
                        "type": "string",
                        "enum": [
                            "info",
                            "aviso",
                            "bloqueio"
                        ]
                    },
                    "texto": {
                        "type": "string"
                    },
                    "campo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "EntradaCalculo": {
                "type": "object",
                "properties": {
                    "plano": {
                        "type": "object",
                        "properties": {
                            "cenario": {
                                "type": "string",
                                "enum": [
                                    "conservador",
                                    "provavel",
                                    "agressivo"
                                ]
                            },
                            "margem_pct": {
                                "type": "number"
                            },
                            "area_erro_pct": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "escala": {
                                "type": "string"
                            },
                            "grau": {
                                "type": "string"
                            },
                            "precise_pontuacao": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "tecnica": {
                                "type": "string"
                            },
                            "captura_id": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "modelo3d_id": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "notas": {
                                "type": "string"
                            }
                        }
                    },
                    "zonas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": [
                                "zona"
                            ],
                            "properties": {
                                "zona": {
                                    "type": "string",
                                    "enum": [
                                        "linha_frontal",
                                        "tufo_central",
                                        "frontal",
                                        "tempora_esq",
                                        "tempora_dir",
                                        "media",
                                        "coroa",
                                        "barba",
                                        "sobrancelha",
                                        "outra"
                                    ]
                                },
                                "area_cm2": {
                                    "oneOf": [
                                        {
                                            "type": "number"
                                        },
                                        {
                                            "$ref": "#/components/schemas/ValorComUnidade"
                                        }
                                    ],
                                    "x-unidade": "cm²"
                                },
                                "densidade_alvo": {
                                    "oneOf": [
                                        {
                                            "type": "number"
                                        },
                                        {
                                            "$ref": "#/components/schemas/ValorComUnidade"
                                        }
                                    ],
                                    "x-unidade": "UF/cm²"
                                },
                                "area_erro_pct": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "origem_area": {
                                    "type": "string",
                                    "enum": [
                                        "manual",
                                        "modelo3d",
                                        "diagrama"
                                    ]
                                },
                                "justificacao": {
                                    "type": "string"
                                },
                                "incluida": {
                                    "type": "boolean"
                                },
                                "fase": {
                                    "type": "integer",
                                    "enum": [
                                        1,
                                        2
                                    ]
                                }
                            }
                        }
                    },
                    "dadoras": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": [
                                "subzona"
                            ],
                            "properties": {
                                "subzona": {
                                    "type": "string",
                                    "enum": [
                                        "occipital",
                                        "parietal_esq",
                                        "parietal_dir",
                                        "barba",
                                        "corpo"
                                    ]
                                },
                                "area_cm2": {
                                    "type": "number",
                                    "x-unidade": "cm²"
                                },
                                "densidade_uf_cm2": {
                                    "type": "number",
                                    "x-unidade": "UF/cm²"
                                },
                                "cabelos_por_uf": {
                                    "type": "number",
                                    "x-unidade": "cabelos/UF"
                                },
                                "calibre_mm": {
                                    "type": "number",
                                    "x-unidade": "mm"
                                },
                                "extraidos_anteriores": {
                                    "type": "integer",
                                    "x-unidade": "enxertos"
                                },
                                "sobrevivencia_pct": {
                                    "type": "number",
                                    "x-unidade": "%"
                                },
                                "amostras": {
                                    "type": "integer"
                                },
                                "desvio": {
                                    "type": "number"
                                }
                            }
                        }
                    },
                    "gravar": {
                        "type": "boolean"
                    }
                }
            },
            "ResultadoMotor": {
                "type": "object",
                "properties": {
                    "bloqueado": {
                        "type": "boolean"
                    },
                    "motivos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Aviso"
                        }
                    },
                    "cenario": {
                        "type": "string"
                    },
                    "numeros": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "necessidade": {
                                "$ref": "#/components/schemas/NumeroMotor"
                            },
                            "residual_minima": {
                                "$ref": "#/components/schemas/NumeroMotor"
                            },
                            "capacidade_vida": {
                                "$ref": "#/components/schemas/NumeroMotor"
                            },
                            "capacidade_sessao": {
                                "$ref": "#/components/schemas/NumeroMotor"
                            },
                            "alternativas": {
                                "$ref": "#/components/schemas/NumeroMotor"
                            },
                            "sessoes": {
                                "$ref": "#/components/schemas/NumeroMotor"
                            },
                            "balanco": {
                                "$ref": "#/components/schemas/NumeroMotor"
                            },
                            "enxertos_viaveis": {
                                "$ref": "#/components/schemas/ValorComUnidade"
                            },
                            "extraidos": {
                                "$ref": "#/components/schemas/ValorComUnidade"
                            },
                            "capacidade_bruta": {
                                "$ref": "#/components/schemas/ValorComUnidade"
                            }
                        }
                    },
                    "zonas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "dadoras": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "alternativas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "plano_sessoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "verificacoes": {
                        "type": "object",
                        "properties": {
                            "precise": {
                                "type": [
                                    "object",
                                    "null"
                                ]
                            },
                            "norwood": {
                                "type": [
                                    "object",
                                    "null"
                                ]
                            }
                        }
                    },
                    "propostas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "codigo": {
                                    "type": "string"
                                },
                                "ordem": {
                                    "type": "integer"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "descricao": {
                                    "type": "string"
                                },
                                "efeito": {
                                    "$ref": "#/components/schemas/ValorComUnidade"
                                },
                                "balanco_depois": {
                                    "$ref": "#/components/schemas/ValorComUnidade"
                                },
                                "cobre": {
                                    "type": "boolean"
                                },
                                "disponivel": {
                                    "type": "boolean"
                                },
                                "razao": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "alteracoes": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    },
                    "avisos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Aviso"
                        }
                    },
                    "cenarios": {
                        "type": "object"
                    },
                    "motor": {
                        "type": "object"
                    },
                    "valor": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "calculado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "impressao_digital": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                },
                "example": {
                    "bloqueado": false,
                    "motivos": [],
                    "cenario": "provavel",
                    "numeros": {
                        "necessidade": {
                            "valor": 5625,
                            "unidade": "enxertos",
                            "min": 5344,
                            "max": 5907,
                            "formula": "N = Σ G × (1 + margem)",
                            "passos": [
                                "Linha frontal: 15 cm² × 25 UF/cm² = 375 enxertos",
                                "…",
                                "Soma das zonas: 5 625 enxertos"
                            ],
                            "parametros": [
                                {
                                    "chave": "margem",
                                    "nome": "Margem",
                                    "valor": 0,
                                    "unidade": "%",
                                    "referencia": null,
                                    "fonte": "sem fonte primária"
                                }
                            ],
                            "fonte": "Análise de referências e funcionalidades, secção 5 (27/10/2026)"
                        },
                        "residual_minima": {
                            "valor": 50,
                            "unidade": "UF/cm²",
                            "criterio": "cabelos"
                        },
                        "capacidade_vida": {
                            "valor": 4750,
                            "unidade": "enxertos",
                            "min": 4512,
                            "max": 4987
                        },
                        "capacidade_sessao": {
                            "valor": 2850,
                            "unidade": "enxertos"
                        },
                        "sessoes": {
                            "valor": 2,
                            "unidade": "sessões"
                        },
                        "balanco": {
                            "valor": -875,
                            "unidade": "enxertos",
                            "min": -1395,
                            "max": -357
                        }
                    },
                    "plano_sessoes": [
                        {
                            "sessao": 1,
                            "enxertos": {
                                "valor": 2850,
                                "unidade": "enxertos"
                            },
                            "densidade_antes": {
                                "valor": 75,
                                "unidade": "UF/cm²"
                            },
                            "densidade_depois": {
                                "valor": 60,
                                "unidade": "UF/cm²"
                            }
                        },
                        {
                            "sessao": 2,
                            "enxertos": {
                                "valor": 1900,
                                "unidade": "enxertos"
                            },
                            "densidade_antes": {
                                "valor": 60,
                                "unidade": "UF/cm²"
                            },
                            "densidade_depois": {
                                "valor": 50,
                                "unidade": "UF/cm²"
                            }
                        }
                    ],
                    "propostas": [
                        {
                            "codigo": "baixar_coroa",
                            "ordem": 1,
                            "efeito": {
                                "valor": 350,
                                "unidade": "enxertos"
                            },
                            "balanco_depois": {
                                "valor": -525,
                                "unidade": "enxertos"
                            },
                            "disponivel": true
                        }
                    ],
                    "avisos": [
                        {
                            "codigo": "limite_dador",
                            "nivel": "aviso",
                            "texto": "Défice de 875 enxertos face à capacidade dadora.",
                            "campo": null
                        }
                    ]
                }
            },
            "PlanoLinha": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "paciente_id": {
                        "type": "integer"
                    },
                    "paciente_nome": {
                        "type": "string"
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "estado": {
                        "type": "string"
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "enxertos_necessarios": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "capacidade_vida": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "sessoes": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "balanco": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "impressao_digital": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "PlanoEditor": {
                "type": "object",
                "properties": {
                    "modo": {
                        "type": "string",
                        "enum": [
                            "completo",
                            "resumo"
                        ]
                    },
                    "plano": {
                        "$ref": "#/components/schemas/PlanoLinha"
                    },
                    "resumo": {
                        "type": "object"
                    },
                    "zonas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "dadoras": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "referencias": {
                        "type": "object"
                    },
                    "areas_diagrama": {
                        "type": "object"
                    },
                    "resultado": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/ResultadoMotor"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "motor": {
                        "type": "object"
                    },
                    "versoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "conta_dadora": {
                        "$ref": "#/components/schemas/ContaDadora"
                    },
                    "simulacao": {
                        "$ref": "#/components/schemas/Simulacao"
                    },
                    "capturas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "tricoscopia": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "permissoes": {
                        "type": "object"
                    },
                    "opcoes": {
                        "type": "object"
                    }
                }
            },
            "Comparacao": {
                "type": "object",
                "properties": {
                    "enxertos": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "cobertura": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "densidade_media": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "zonas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "sessoes": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "dadora_restante": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "disponivel": {
                        "type": "boolean"
                    },
                    "razao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "ContaDadora": {
                "type": "object",
                "properties": {
                    "capacidade": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "extraidos": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "reserva": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "reserva_pct": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "disponivel": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "planeado": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "teto_vida": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "teto_usado": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "usado": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "formula": {
                        "type": "string"
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "SimulacaoGerada": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "plano_id": {
                        "type": "integer"
                    },
                    "cenario": {
                        "type": "string",
                        "enum": [
                            "conservador",
                            "provavel",
                            "agressivo"
                        ]
                    },
                    "cenario_rotulo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "por_validar",
                            "validada",
                            "rejeitada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "rosto": {
                        "type": "string",
                        "enum": [
                            "desfocado",
                            "visivel",
                            "sem_rosto"
                        ]
                    },
                    "rosto_rotulo": {
                        "type": "string"
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri"
                    },
                    "foto_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "foto_origem_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "sha256": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "servico": {
                        "type": "string",
                        "enum": [
                            "local",
                            "externo"
                        ]
                    },
                    "servico_rotulo": {
                        "type": "string"
                    },
                    "semelhanca": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "criado_por_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "validada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "validada_por_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "nota": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "usada_no_plano": {
                        "type": "boolean"
                    }
                }
            },
            "SimulacaoIaEstado": {
                "type": "object",
                "properties": {
                    "disponivel": {
                        "type": "boolean"
                    },
                    "migracao": {
                        "type": "boolean"
                    },
                    "configurado": {
                        "type": "boolean"
                    },
                    "consentimento": {
                        "type": "boolean"
                    },
                    "rosto_visivel": {
                        "type": "boolean"
                    },
                    "aviso": {
                        "type": "string"
                    },
                    "cenario_plano": {
                        "type": "string"
                    },
                    "cenarios": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "fotos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "geradas": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/SimulacaoGerada"
                        }
                    },
                    "limite": {
                        "type": "integer"
                    },
                    "permissoes": {
                        "type": "object",
                        "properties": {
                            "gerar": {
                                "type": "boolean"
                            },
                            "validar": {
                                "type": "boolean"
                            },
                            "usar": {
                                "type": "boolean"
                            }
                        }
                    },
                    "gerada": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/SimulacaoGerada"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                }
            },
            "Simulacao": {
                "type": "object",
                "properties": {
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri"
                    },
                    "aviso": {
                        "type": "string"
                    },
                    "sha256": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mostrada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "mostrada_por_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "aviso_aceite_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "aviso_canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "presencial",
                            "portal",
                            "app",
                            null
                        ]
                    }
                },
                "example": {
                    "ficheiro_id": 7781,
                    "aviso": "Ilustrativo, sem garantia de resultado",
                    "mostrada_em": "2026-10-28T12:00:00+00:00",
                    "aviso_aceite_em": null
                }
            },
            "VersaoMotorLinha": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "rascunho",
                            "aprovada",
                            "arquivada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "aprovado_por_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "base_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    }
                }
            },
            "VersaoMotor": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/VersaoMotorLinha"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "quadro": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "cenarios": {
                                "type": "object"
                            },
                            "ordem_propostas": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "tabela_norwood": {
                                "type": "object"
                            },
                            "areas_diagrama": {
                                "type": "object"
                            },
                            "notas": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "finalidade_regulamentar": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "diferencas": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "permissoes": {
                                "type": "object"
                            }
                        }
                    }
                ]
            },
            "Protocolo": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "marco": {
                        "type": "string"
                    },
                    "vistas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "instrucoes": {
                                    "type": "string"
                                },
                                "silhueta": {
                                    "type": "string",
                                    "enum": [
                                        "frontal",
                                        "frontal_inclinada",
                                        "topo",
                                        "coroa",
                                        "lateral_esq",
                                        "lateral_dir",
                                        "dadora"
                                    ]
                                }
                            }
                        }
                    }
                }
            },
            "Qualidade": {
                "type": "object",
                "properties": {
                    "avaliada": {
                        "type": "boolean"
                    },
                    "ok": {
                        "type": [
                            "boolean",
                            "null"
                        ]
                    },
                    "pontuacao": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "largura": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "altura": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "nitidez": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "brilho": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "motivos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "textos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "Foto": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "paciente_id": {
                        "type": "integer"
                    },
                    "captura_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "marco_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "ficheiro_id": {
                        "type": "integer"
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri"
                    },
                    "vista": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "zona": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "etiquetas": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "album": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "origem": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string"
                    },
                    "partilhada_paciente": {
                        "type": "boolean"
                    },
                    "rosto_desfocado": {
                        "type": "boolean"
                    },
                    "simulacao": {
                        "type": "boolean"
                    },
                    "qualidade": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "Modelo3d": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "paciente_id": {
                        "type": "integer"
                    },
                    "formato": {
                        "type": "string",
                        "enum": [
                            "glb",
                            "gltf",
                            "obj",
                            "ply",
                            "stl",
                            "usdz"
                        ]
                    },
                    "visualizavel": {
                        "type": "boolean"
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "descarregar": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ligacao_visualizador": {
                        "type": "object"
                    },
                    "cobertura_pct": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "cobertura_ok": {
                        "type": "boolean"
                    },
                    "escala_confirmada": {
                        "type": "boolean"
                    },
                    "qualidade": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "referencias": {
                        "type": "object"
                    },
                    "zonas": {
                        "type": "object"
                    },
                    "area_dadora": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "origem": {
                        "type": "string",
                        "enum": [
                            "carregado",
                            "lidar",
                            "profundidade"
                        ]
                    },
                    "aparelho": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "cobertura_origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "malha",
                            "captura",
                            "manual",
                            null
                        ]
                    },
                    "escala_metodo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "escala_fator": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "description": "cm por unidade do modelo"
                    },
                    "unidade_modelo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "malha": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "referencial": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "captura": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "zonas_erro": {
                        "type": "object"
                    },
                    "dadoras": {
                        "type": "object"
                    },
                    "espessura_cabelo": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "linha_frontal": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "simulacao": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "marcacoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "pontos_tricoscopia": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "partilhas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "CampoTricoscopia": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "paciente_id": {
                        "type": "integer"
                    },
                    "subzona": {
                        "type": "string"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "aparelho": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ampliacao": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "area_campo_mm2": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "ponto": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "uf_1": {
                        "type": "integer"
                    },
                    "uf_2": {
                        "type": "integer"
                    },
                    "uf_3": {
                        "type": "integer"
                    },
                    "uf_4": {
                        "type": "integer"
                    },
                    "densidade_uf_cm2": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "densidade_cabelos_cm2": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "cabelos_por_uf": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "calibre_mm": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    }
                }
            },
            "CalculoCampo": {
                "type": "object",
                "properties": {
                    "uf_total": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "cabelos_total": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "densidade_uf_cm2": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "densidade_cabelos_cm2": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "cabelos_por_uf": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "calibre": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "composicao": {
                        "type": "object"
                    },
                    "pct_vellus": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "pct_intermedios": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "pct_terminais": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "miniaturizacao": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "racio_terminal_vellus": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "valor_cobertura": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "avisos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "formulas": {
                        "type": "object"
                    },
                    "limiares": {
                        "type": "object"
                    }
                }
            },
            "QuadroMarcos": {
                "type": "object",
                "properties": {
                    "colunas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "estado": {
                                    "type": "string"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "tom": {
                                    "type": "string"
                                },
                                "contagem": {
                                    "type": "integer"
                                },
                                "cartoes": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    },
                    "kpis": {
                        "type": "object"
                    },
                    "marcos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "permissoes": {
                        "type": "object"
                    }
                }
            },
            "DetalheMarco": {
                "type": "object",
                "properties": {
                    "marco": {
                        "type": "object"
                    },
                    "paciente": {
                        "type": "object"
                    },
                    "questionario": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "fotos": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "circuito": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "metricas": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "tratamentos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "permissoes": {
                        "type": "object"
                    }
                }
            },
            "Caixa": {
                "type": "object",
                "properties": {
                    "x": {
                        "type": "number"
                    },
                    "y": {
                        "type": "number"
                    },
                    "largura": {
                        "type": "number"
                    },
                    "altura": {
                        "type": "number"
                    }
                },
                "description": "0–1 fractions of the image."
            },
            "ElementoDesenho": {
                "type": "object",
                "required": [
                    "tipo",
                    "pontos"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "pattern": "^[a-z0-9_-]{1,24}$"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "traco",
                            "seta",
                            "texto",
                            "medida"
                        ]
                    },
                    "pontos": {
                        "type": "array",
                        "items": {
                            "type": "array",
                            "items": {
                                "type": "number"
                            },
                            "minItems": 2,
                            "maxItems": 2
                        }
                    },
                    "cor": {
                        "type": "string",
                        "enum": [
                            "marca",
                            "ouro",
                            "dadora",
                            "info",
                            "aviso",
                            "perigo",
                            "sucesso",
                            "tinta"
                        ]
                    },
                    "espessura": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 8
                    },
                    "tracejado": {
                        "type": "boolean"
                    },
                    "fechado": {
                        "type": "boolean"
                    },
                    "texto": {
                        "type": "string",
                        "maxLength": 200
                    },
                    "tamanho": {
                        "type": "integer",
                        "minimum": 10,
                        "maximum": 48
                    },
                    "referencia_mm": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "comprimento_px": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "readOnly": true
                    },
                    "comprimento_mm": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "readOnly": true
                    }
                }
            },
            "Anotacoes": {
                "type": "object",
                "properties": {
                    "foto": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "paciente_id": {
                                "type": "integer"
                            },
                            "ficheiro_id": {
                                "type": "integer"
                            },
                            "url": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "largura": {
                                "type": "integer"
                            },
                            "altura": {
                                "type": "integer"
                            },
                            "vista": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "vista_rotulo": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "rosto_desfocado": {
                                "type": "boolean"
                            },
                            "simulacao": {
                                "type": "boolean"
                            }
                        }
                    },
                    "camadas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "ordem": {
                                    "type": "integer"
                                },
                                "visivel": {
                                    "type": "boolean"
                                },
                                "origem": {
                                    "type": "string",
                                    "enum": [
                                        "manual",
                                        "proporcoes"
                                    ]
                                },
                                "autor_nome": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "atualizado_em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "editavel": {
                                    "type": "boolean"
                                },
                                "elementos": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/ElementoDesenho"
                                    }
                                }
                            }
                        }
                    },
                    "escala": {
                        "type": "object",
                        "properties": {
                            "mm_px": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "camada_id": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            }
                        }
                    },
                    "cores": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "tipos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "permissoes": {
                        "type": "object"
                    },
                    "camada_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    }
                }
            },
            "AnaliseImagem": {
                "type": "object",
                "description": "Vision AI proposal with traceability.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "tricoscopia_contagem",
                            "desfocagem",
                            "proporcoes"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pendente",
                            "aceite",
                            "corrigida",
                            "recusada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "paciente_id": {
                        "type": "integer"
                    },
                    "foto_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "tricoscopia_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "plano_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "contexto": {
                        "type": "object"
                    },
                    "fatores": {
                        "type": "object"
                    },
                    "confianca": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "fornecedor": {
                        "type": "string"
                    },
                    "fornecedor_rotulo": {
                        "type": "string"
                    },
                    "modelo": {
                        "type": "string"
                    },
                    "parametros": {
                        "type": "object"
                    },
                    "decidido_por_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "decidido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "AnaliseTricoscopia": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/AnaliseImagem"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "proposta": {
                                "type": "object",
                                "properties": {
                                    "valores": {
                                        "type": "object"
                                    },
                                    "diametros_um": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    },
                                    "qualidade": {
                                        "type": "string",
                                        "enum": [
                                            "boa",
                                            "media",
                                            "insuficiente"
                                        ]
                                    },
                                    "qualidade_rotulo": {
                                        "type": "string"
                                    },
                                    "observacoes": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "calculo": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/CalculoCampo"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ]
                            },
                            "final": {
                                "type": [
                                    "object",
                                    "null"
                                ]
                            }
                        }
                    }
                ]
            },
            "AnaliseProporcoes": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/AnaliseImagem"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "proposta": {
                                "type": "object",
                                "properties": {
                                    "trichion": {
                                        "type": "number"
                                    },
                                    "glabela": {
                                        "type": "number"
                                    },
                                    "subnasal": {
                                        "type": "number"
                                    },
                                    "mento": {
                                        "type": "number"
                                    },
                                    "linha_media": {
                                        "type": "number"
                                    }
                                }
                            },
                            "final": {
                                "type": [
                                    "object",
                                    "null"
                                ]
                            },
                            "tercos": {
                                "type": [
                                    "object",
                                    "null"
                                ]
                            },
                            "sugestao": {
                                "type": [
                                    "object",
                                    "null"
                                ],
                                "description": "Suggested trichion, subir_mm (positive = suggested line above the current one), altura_glabela_mm, ratio, text and formula."
                            },
                            "camada_id": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            }
                        }
                    }
                ]
            },
            "MedicaoCapilar": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "tricograma",
                            "massa_capilar"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "paciente_id": {
                        "type": "integer"
                    },
                    "subzona": {
                        "type": "string"
                    },
                    "ponto": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "aparado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "horas": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "anagenio": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "telogenio": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "pct_anagenio": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "racio_at": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "indice_massa": {
                        "$ref": "#/components/schemas/ValorComUnidade"
                    },
                    "avisos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "AnalisePlano": {
                "type": "object",
                "properties": {
                    "plano": {
                        "type": "object"
                    },
                    "perda_futura": {
                        "type": "object"
                    },
                    "expectativas": {
                        "type": "object"
                    },
                    "real": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "proporcoes": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/AnaliseProporcoes"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "fotos_frontais": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "permissoes": {
                        "type": "object"
                    }
                }
            },
            "Execucao": {
                "type": "object",
                "properties": {
                    "execucao": {
                        "type": "object"
                    },
                    "cirurgia": {
                        "type": "object"
                    },
                    "plano": {
                        "type": "object"
                    },
                    "zonas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "dia0": {
                        "type": "object"
                    },
                    "implantacao": {
                        "type": "object"
                    },
                    "real": {
                        "type": "object"
                    },
                    "capturas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "origens": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "permissoes": {
                        "type": "object"
                    }
                }
            },
            "PortalMarcacao": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pedido",
                            "marcada",
                            "confirmada",
                            "em_curso",
                            "concluida",
                            "faltou",
                            "cancelada",
                            "remarcada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "tom": {
                        "type": "string"
                    },
                    "tipo": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "teleconsulta": {
                                "type": "boolean"
                            },
                            "cor": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "profissional": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "profissional_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pode_confirmar": {
                        "type": "boolean"
                    },
                    "pode_alterar": {
                        "type": "boolean"
                    },
                    "pode_cancelar": {
                        "type": "boolean"
                    },
                    "limite_alteracao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "politica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "antecedencia_h": {
                        "type": "integer",
                        "x-unidade": "h"
                    },
                    "teleconsulta": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "estado": {
                                "type": "string"
                            },
                            "estado_rotulo": {
                                "type": "string"
                            },
                            "pode_entrar": {
                                "type": "boolean"
                            },
                            "abre_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "consentimento_dado": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            },
            "PortalVaga": {
                "type": "object",
                "properties": {
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "profissional_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "profissional": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "PortalTipoMarcacao": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "duracao_min": {
                        "type": "integer",
                        "x-unidade": "min"
                    },
                    "teleconsulta": {
                        "type": "boolean"
                    },
                    "exige_sinal": {
                        "type": "boolean"
                    },
                    "valor_sinal": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "politica_cancelamento": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "antecedencia_h": {
                        "type": "integer",
                        "x-unidade": "h"
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "PortalPlano": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "episodio": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "enxertos_necessarios": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "enxertos"
                    },
                    "sessoes": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "cenario": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "cenario_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "aprovado_por": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "area_total_cm2": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "cm²"
                    },
                    "zonas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "zona": {
                                    "type": "string"
                                },
                                "zona_rotulo": {
                                    "type": "string"
                                },
                                "area_cm2": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "cm²"
                                },
                                "densidade_alvo": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "UF/cm²"
                                },
                                "enxertos": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "x-unidade": "enxertos"
                                }
                            }
                        }
                    },
                    "simulacao": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "The link (url) only exists after the «Illustrative, with no guarantee of results» notice is accepted.",
                        "properties": {
                            "disponivel": {
                                "type": "boolean"
                            },
                            "aviso_aceite_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "url": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            },
            "PortalProposta": {
                "type": "object",
                "description": "Never includes internal costs, margins or commissions.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "enviada",
                            "vista",
                            "aceite",
                            "expirada",
                            "recusada"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "total": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "moeda": {
                        "type": "string"
                    },
                    "validade_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "enviada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "aceite_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "pode_aceitar": {
                        "type": "boolean"
                    },
                    "pdf_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "linhas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "opcoes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "descricao": {
                                    "type": "string"
                                },
                                "total": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "x-unidade": "EUR"
                                }
                            }
                        }
                    },
                    "subtotal": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "desconto_valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "iva_valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "prestacoes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "opcao_aceite": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "plano_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    }
                }
            },
            "PortalDocumento": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "origem": {
                        "type": "string",
                        "enum": [
                            "documento",
                            "ficheiro"
                        ]
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string"
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "assinado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "codigo_verificacao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pode_assinar": {
                        "type": "boolean"
                    },
                    "lido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Signed link /f/<token>, 15 minutes."
                    },
                    "url_descarregar": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "PortalFormulario": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "seccoes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "titulo": {
                                    "type": "string"
                                },
                                "campos": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "chave": {
                                                "type": "string"
                                            },
                                            "tipo": {
                                                "type": "string",
                                                "enum": [
                                                    "texto",
                                                    "textoLongo",
                                                    "numero",
                                                    "data",
                                                    "booleano",
                                                    "escolha",
                                                    "multiEscolha"
                                                ]
                                            },
                                            "rotulo": {
                                                "type": "string"
                                            },
                                            "ajuda": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "obrigatorio": {
                                                "type": "boolean"
                                            },
                                            "opcoes": {
                                                "type": "array",
                                                "items": {
                                                    "type": "object",
                                                    "properties": {
                                                        "valor": {
                                                            "type": "string"
                                                        },
                                                        "rotulo": {
                                                            "type": "string"
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "PortalFinalidade": {
                "type": "object",
                "properties": {
                    "finalidade": {
                        "type": "string"
                    },
                    "rotulo": {
                        "type": "string"
                    },
                    "descricao": {
                        "type": "string"
                    },
                    "decisao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "dado",
                            "recusado",
                            "revogado",
                            null
                        ]
                    },
                    "decisao_rotulo": {
                        "type": "string"
                    },
                    "em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "canal_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "obrigatorio": {
                        "type": "boolean"
                    },
                    "base_legal": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "base_legal_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pode_revogar": {
                        "type": "boolean"
                    },
                    "pode_dar": {
                        "type": "boolean"
                    },
                    "modelo_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    }
                }
            },
            "PortalModeloConsentimento": {
                "type": "object",
                "properties": {
                    "modelo_id": {
                        "type": "integer"
                    },
                    "chave": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "finalidade": {
                        "type": "string"
                    },
                    "finalidade_rotulo": {
                        "type": "string"
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "obrigatorio": {
                        "type": "boolean"
                    },
                    "reflexao_horas": {
                        "type": "integer",
                        "x-unidade": "h"
                    },
                    "informacao_entregue_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "pode_assinar_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "pode_assinar": {
                        "type": "boolean"
                    },
                    "precisa_ler": {
                        "type": "boolean"
                    },
                    "texto": {
                        "type": "string",
                        "description": "Sanitised HTML (detail only)."
                    },
                    "campos_dgs": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "texto": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "assinatura": {
                        "type": "boolean"
                    },
                    "decisao_atual": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "motivo_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "PortalFoto": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "ficheiro_id": {
                        "type": "integer"
                    },
                    "vista": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "vista_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string"
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "luz": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "nitidez": {
                        "type": [
                            "number",
                            "null"
                        ]
                    }
                }
            },
            "PortalMensagem": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "minha": {
                        "type": "boolean"
                    },
                    "autor": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "corpo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "anexos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "nome": {
                                    "type": "string"
                                },
                                "tipo": {
                                    "type": "string"
                                },
                                "url": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                }
            },
            "PortalPagamento": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "moeda": {
                        "type": "string"
                    },
                    "metodo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "metodo_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string"
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "tom": {
                        "type": "string"
                    },
                    "mb_entidade": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mb_referencia": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mb_validade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "vence_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "pago_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "pode_pagar": {
                        "type": "boolean"
                    },
                    "fatura": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/PortalFatura"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                }
            },
            "PortalFatura": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "atcud": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "total": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "iva": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "emitido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "PortalSaldo": {
                "type": [
                    "object",
                    "null"
                ],
                "properties": {
                    "total_aceite": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "pago": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "em_divida": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "pendente": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "pendentes": {
                        "type": "integer"
                    },
                    "moeda": {
                        "type": "string"
                    },
                    "pct_pago": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "x-unidade": "%"
                    }
                }
            },
            "PortalInstrucoesPagamento": {
                "type": "object",
                "properties": {
                    "pagamento_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "metodo": {
                        "type": "string"
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "x-unidade": "EUR"
                    },
                    "mb_entidade": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mb_referencia": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mb_validade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mensagem": {
                        "type": "string"
                    }
                }
            },
            "PortalMarco": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "marco": {
                        "type": "string",
                        "enum": [
                            "d1",
                            "s1",
                            "m1",
                            "m2",
                            "m6",
                            "m9",
                            "m12",
                            "m18"
                        ]
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "data_prevista": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "estado": {
                        "type": "string"
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "feito": {
                        "type": "boolean"
                    },
                    "passado": {
                        "type": "boolean"
                    },
                    "pede_fotos": {
                        "type": "boolean"
                    },
                    "marcacao_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "calculado": {
                        "type": "boolean"
                    }
                }
            },
            "PortalConteudoFase": {
                "type": "object",
                "properties": {
                    "origem": {
                        "type": "string",
                        "enum": [
                            "clinica",
                            "geral"
                        ]
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "html": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "itens": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "videos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "titulo": {
                                    "type": "string"
                                },
                                "url": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "mime": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "PortalAcesso": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "quando": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "quem": {
                        "type": "string"
                    },
                    "funcao": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ator_tipo": {
                        "type": "string"
                    },
                    "proprio": {
                        "type": "boolean"
                    },
                    "acao": {
                        "type": "string"
                    },
                    "acao_rotulo": {
                        "type": "string"
                    },
                    "area": {
                        "type": "string"
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "origem_rotulo": {
                        "type": "string"
                    },
                    "emergencia": {
                        "type": "boolean"
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Emergency accesses only."
                    }
                }
            },
            "PortalPedido": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "contactos",
                            "alergias",
                            "acesso",
                            "retificacao",
                            "portabilidade",
                            "apagamento",
                            "oposicao",
                            "limitacao",
                            "eliminar_conta"
                        ]
                    },
                    "tipo_rotulo": {
                        "type": "string"
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "pendente",
                            "em_analise",
                            "aceite",
                            "recusado",
                            "concluido",
                            "cancelado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "prazo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "decidido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "resposta": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "mensagem": {
                        "type": "string"
                    }
                }
            },
            "PortalNovidade": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "tipo": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "corpo": {
                        "type": "string"
                    },
                    "ligacao": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "web": {
                                "type": "string"
                            },
                            "app": {
                                "type": "string"
                            }
                        }
                    },
                    "lida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "PortalDados": {
                "type": "object",
                "properties": {
                    "paciente": {
                        "type": "object",
                        "properties": {
                            "numero": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "nome_completo": {
                                "type": "string"
                            },
                            "data_nascimento": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date"
                            },
                            "email": {
                                "type": "string"
                            },
                            "telefone": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "telefone_alt": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "morada": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "codigo_postal": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "localidade": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "pais": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "idioma": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "alergias": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "descricao": {
                                    "type": "string"
                                },
                                "gravidade": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "gravidade_rotulo": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "validado": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "preferencias": {
                        "type": "object",
                        "properties": {
                            "idioma": {
                                "type": "string"
                            },
                            "canal_preferido": {
                                "type": "string",
                                "enum": [
                                    "email",
                                    "sms",
                                    "whatsapp",
                                    "telefone"
                                ]
                            },
                            "lembretes": {
                                "type": "boolean"
                            },
                            "horario": {
                                "type": "string",
                                "enum": [
                                    "manha",
                                    "tarde",
                                    "qualquer"
                                ]
                            },
                            "avisos_email": {
                                "type": "boolean"
                            },
                            "marketing": {
                                "type": "boolean"
                            }
                        }
                    },
                    "pedidos": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/PortalPedido"
                        }
                    },
                    "conta": {
                        "type": "object"
                    },
                    "direitos": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "conservacao": {
                        "type": "string"
                    },
                    "encarregado": {
                        "type": "object"
                    },
                    "clinica": {
                        "type": "object"
                    },
                    "idiomas": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "DesafioEscudo": {
                "type": [
                    "object",
                    "null"
                ],
                "properties": {
                    "desafio": {
                        "type": "string"
                    },
                    "salt": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{32}$"
                    },
                    "bits": {
                        "type": "integer"
                    },
                    "nivel": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 4
                    },
                    "valido_por": {
                        "type": "integer"
                    },
                    "minimo_ms": {
                        "type": "integer"
                    }
                }
            },
            "AvisoCanal": {
                "type": [
                    "object",
                    "null"
                ],
                "description": "Privacy notice in force for the channel (versioned, immutable once published), with the token of the version shown: send it back as «aviso_testemunho» on submission. Null when the clinic has no published notice for the channel.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "canal": {
                        "type": "string"
                    },
                    "canal_rotulo": {
                        "type": "string"
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "texto": {
                        "type": "string",
                        "description": "Sanitised HTML."
                    },
                    "idioma": {
                        "type": "string",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ]
                    },
                    "publicado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "resumo": {
                        "type": "string",
                        "description": "SHA-256 of the published text."
                    },
                    "contexto": {
                        "type": "string"
                    },
                    "testemunho": {
                        "type": "string",
                        "description": "Signed token (24 h) of the version shown."
                    }
                }
            },
            "PreAvaliacaoConsulta": {
                "type": "object",
                "description": "Consultation choice (sign-up link with photos): formats with the matching appointment type, time-of-day options and allowed dates.",
                "properties": {
                    "ativa": {
                        "type": "boolean"
                    },
                    "obrigatoria": {
                        "type": "boolean"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "texto": {
                        "type": "string"
                    },
                    "modalidades": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "valor": {
                                    "type": "string",
                                    "enum": [
                                        "presencial",
                                        "telefone",
                                        "video"
                                    ]
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "descricao": {
                                    "type": "string"
                                },
                                "tipo_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "tipo_nome": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "duracao": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "periodos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "valor": {
                                    "type": "string",
                                    "enum": [
                                        "manha",
                                        "tarde",
                                        "fim_dia"
                                    ]
                                },
                                "rotulo": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "data_minima": {
                        "type": "string",
                        "format": "date"
                    },
                    "data_maxima": {
                        "type": "string",
                        "format": "date"
                    }
                }
            },
            "SiteIncorporacao": {
                "type": "object",
                "description": "Assessment embedded in other websites: status, authorised websites and the line of code.",
                "properties": {
                    "ativa": {
                        "type": "boolean",
                        "description": "Switched on and with the assessment active."
                    },
                    "ligada": {
                        "type": "boolean"
                    },
                    "pre_avaliacao_ativa": {
                        "type": "boolean"
                    },
                    "dominios": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "description": "Authorised origin (https://domain or https://*.domain)."
                        }
                    },
                    "invalidos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "codigo_clinica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "url_script": {
                        "type": "string",
                        "format": "uri"
                    },
                    "url_pagina": {
                        "type": "string",
                        "format": "uri"
                    },
                    "url_pre_visualizar": {
                        "type": "string",
                        "format": "uri"
                    },
                    "origem_propria": {
                        "type": "string"
                    },
                    "codigo": {
                        "type": "object",
                        "properties": {
                            "pt": {
                                "type": "string"
                            },
                            "en": {
                                "type": "string"
                            },
                            "contentor": {
                                "type": "string"
                            }
                        }
                    },
                    "mensagens": {
                        "type": "object",
                        "properties": {
                            "enviado": {
                                "type": "string",
                                "description": "Event dispatched on the script element when the person submits."
                            }
                        }
                    }
                }
            },
            "SitePaginaEditor": {
                "type": "object",
                "description": "Website page with its status per language.",
                "properties": {
                    "chave": {
                        "type": "string"
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "institucional",
                            "procedimento",
                            "legal",
                            "caso"
                        ]
                    },
                    "ordem": {
                        "type": "integer"
                    },
                    "idiomas": {
                        "type": "object",
                        "description": "Per language (pt, en).",
                        "additionalProperties": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "slug": {
                                    "type": "string"
                                },
                                "publicada": {
                                    "type": "boolean"
                                },
                                "versao": {
                                    "type": "integer"
                                },
                                "publicada_em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "atualizado_em": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "blocos": {
                        "type": "integer",
                        "description": "Editable catalogue blocks."
                    },
                    "personalizados": {
                        "type": "object",
                        "description": "Saved blocks per language.",
                        "additionalProperties": {
                            "type": "integer"
                        }
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    }
                }
            },
            "SiteBloco": {
                "type": "object",
                "description": "Editable block (text, image, list or link).",
                "properties": {
                    "id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "pagina": {
                        "type": "string"
                    },
                    "chave": {
                        "type": "string"
                    },
                    "idioma": {
                        "type": "string",
                        "enum": [
                            "pt",
                            "en"
                        ]
                    },
                    "tipo": {
                        "type": "string",
                        "enum": [
                            "texto",
                            "textoLongo",
                            "html",
                            "imagem",
                            "lista",
                            "ligacao"
                        ]
                    },
                    "seccao": {
                        "type": "string"
                    },
                    "rotulo": {
                        "type": "string"
                    },
                    "ajuda": {
                        "type": "string"
                    },
                    "valor": {
                        "description": "texto/textoLongo/html/imagem: string (for images, the description); lista: array of objects; ligacao: {texto, url}."
                    },
                    "campos": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "For lists: field → type (texto, textoLongo, linhas, numero).",
                        "additionalProperties": {
                            "type": "string"
                        }
                    },
                    "imagem": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "url": {
                                "type": "string"
                            },
                            "nome": {
                                "type": "string"
                            },
                            "largura": {
                                "type": "integer"
                            },
                            "altura": {
                                "type": "integer"
                            }
                        }
                    },
                    "personalizado": {
                        "type": "boolean"
                    },
                    "atualizado_em": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "ordem": {
                        "type": "integer"
                    }
                }
            },
            "SiteImagem": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "mime": {
                        "type": "string",
                        "enum": [
                            "image/jpeg",
                            "image/png",
                            "image/webp",
                            "image/gif"
                        ]
                    },
                    "largura": {
                        "type": "integer",
                        "x-unidade": "px"
                    },
                    "altura": {
                        "type": "integer",
                        "x-unidade": "px"
                    },
                    "tamanho": {
                        "type": "integer",
                        "x-unidade": "bytes"
                    },
                    "alt_pt": {
                        "type": "string"
                    },
                    "alt_en": {
                        "type": "string"
                    },
                    "usos": {
                        "type": "integer",
                        "description": "Blocks and pages using it (can only be deleted at 0)."
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "SiteVersao": {
                "type": "object",
                "description": "Immutable published version.",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "versao": {
                        "type": "integer"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "conteudo_hash": {
                        "type": "string",
                        "description": "SHA-256 of the published content."
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "criado_por": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "SiteCookiesResumo": {
                "type": "object",
                "properties": {
                    "aceitar": {
                        "type": "integer"
                    },
                    "rejeitar": {
                        "type": "integer"
                    },
                    "personalizar": {
                        "type": "integer"
                    },
                    "total": {
                        "type": "integer"
                    },
                    "taxa_aceitacao": {
                        "type": "number",
                        "x-unidade": "%"
                    },
                    "taxa_rejeicao": {
                        "type": "number",
                        "x-unidade": "%"
                    },
                    "categorias": {
                        "type": "object",
                        "properties": {
                            "preferencias": {
                                "type": "integer"
                            },
                            "estatistica": {
                                "type": "integer"
                            },
                            "marketing": {
                                "type": "integer"
                            }
                        }
                    },
                    "donut": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "integer"
                                },
                                "decisao": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "serie": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "integer"
                                },
                                "serie": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "versao_politica": {
                        "type": "string"
                    }
                }
            },
            "SiteAoVivo": {
                "type": "object",
                "properties": {
                    "minutos": {
                        "type": "integer"
                    },
                    "visitas": {
                        "type": "integer"
                    },
                    "ativos_agora": {
                        "type": "integer",
                        "description": "Sessions active in the last 5 minutes."
                    },
                    "cookies": {
                        "type": "object",
                        "properties": {
                            "aceitar": {
                                "type": "integer"
                            },
                            "rejeitar": {
                                "type": "integer"
                            },
                            "personalizar": {
                                "type": "integer"
                            },
                            "total": {
                                "type": "integer"
                            },
                            "ultimas": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "decisao": {
                                            "type": "string",
                                            "enum": [
                                                "aceitar",
                                                "rejeitar",
                                                "personalizar"
                                            ]
                                        },
                                        "categorias": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "em": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "format": "date-time"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "SiteAnalytics": {
                "type": "object",
                "description": "Own anonymous statistics, without cookies.",
                "properties": {
                    "periodo": {
                        "type": "object",
                        "properties": {
                            "de": {
                                "type": "string"
                            },
                            "ate": {
                                "type": "string"
                            },
                            "dias": {
                                "type": "integer"
                            },
                            "area": {
                                "type": "string"
                            }
                        }
                    },
                    "kpis": {
                        "type": "object",
                        "properties": {
                            "visitas": {
                                "type": "integer"
                            },
                            "visitas_delta": {
                                "type": [
                                    "number",
                                    "null"
                                ],
                                "x-unidade": "%"
                            },
                            "sessoes": {
                                "type": "integer"
                            },
                            "sessoes_delta": {
                                "type": [
                                    "number",
                                    "null"
                                ],
                                "x-unidade": "%"
                            },
                            "paginas_por_sessao": {
                                "type": "number"
                            },
                            "telemovel_pct": {
                                "type": "number",
                                "x-unidade": "%"
                            },
                            "pre_avaliacoes": {
                                "type": "integer"
                            },
                            "conversao_pct": {
                                "type": "number",
                                "x-unidade": "%"
                            },
                            "aceitacao_cookies_pct": {
                                "type": "number",
                                "x-unidade": "%"
                            }
                        }
                    },
                    "serie": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "integer"
                                },
                                "serie": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "paginas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "caminho": {
                                    "type": "string"
                                },
                                "area": {
                                    "type": "string"
                                },
                                "visitas": {
                                    "type": "integer"
                                },
                                "sessoes": {
                                    "type": "integer"
                                }
                            }
                        }
                    },
                    "origens": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "integer"
                                },
                                "serie": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "campanhas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "campanha": {
                                    "type": "string"
                                },
                                "fonte": {
                                    "type": "string"
                                },
                                "meio": {
                                    "type": "string"
                                },
                                "visitas": {
                                    "type": "integer"
                                }
                            }
                        }
                    },
                    "dispositivos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "integer"
                                },
                                "serie": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "idiomas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "x": {
                                    "type": "string"
                                },
                                "y": {
                                    "type": "integer"
                                },
                                "serie": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "conversoes": {
                        "type": "object",
                        "properties": {
                            "pre_avaliacoes": {
                                "type": "integer"
                            },
                            "leads": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "pedidos_demonstracao": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "serie": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "x": {
                                            "type": "string"
                                        },
                                        "y": {
                                            "type": "integer"
                                        },
                                        "serie": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "cookies": {
                        "$ref": "#/components/schemas/SiteCookiesResumo"
                    },
                    "ao_vivo": {
                        "$ref": "#/components/schemas/SiteAoVivo"
                    }
                }
            },
            "PreAvaliacaoEsquema": {
                "type": "object",
                "description": "The clinic's online assessment form (questions, photo views, consents and limits).",
                "properties": {
                    "ativo": {
                        "type": "boolean"
                    },
                    "idioma": {
                        "type": "string"
                    },
                    "titulo": {
                        "type": "string"
                    },
                    "lead": {
                        "type": "string"
                    },
                    "aviso_privacidade": {
                        "type": "string",
                        "description": "Sanitised HTML of the versioned «site» channel notice (or, with no published notice, the CMS framing). Kept for older app versions."
                    },
                    "aviso": {
                        "$ref": "#/components/schemas/AvisoCanal"
                    },
                    "aviso_enquadramento": {
                        "type": "string",
                        "description": "Notice framing text (CMS, sanitised HTML)."
                    },
                    "consulta": {
                        "$ref": "#/components/schemas/PreAvaliacaoConsulta"
                    },
                    "passos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string",
                                    "enum": [
                                        "privacidade",
                                        "sobre",
                                        "consentimentos",
                                        "cabelo",
                                        "saude",
                                        "fotografias",
                                        "consulta",
                                        "revisao"
                                    ]
                                },
                                "titulo": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "perguntas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "passo": {
                                    "type": "string"
                                },
                                "tipo": {
                                    "type": "string",
                                    "enum": [
                                        "texto",
                                        "textoLongo",
                                        "email",
                                        "telefone",
                                        "numero",
                                        "escolha",
                                        "multiEscolha",
                                        "booleano",
                                        "data"
                                    ]
                                },
                                "obrigatorio": {
                                    "type": "boolean"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "ajuda": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "opcoes": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "valor": {
                                                "type": "string"
                                            },
                                            "rotulo": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                },
                                "min": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "max": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                }
                            }
                        }
                    },
                    "formulario": {
                        "type": "object",
                        "properties": {
                            "origem": {
                                "type": "string",
                                "enum": [
                                    "clinica",
                                    "site"
                                ]
                            },
                            "id": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "versao": {
                                "type": "integer"
                            }
                        }
                    },
                    "vistas": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "titulo": {
                                    "type": "string"
                                },
                                "instrucoes": {
                                    "type": "string"
                                },
                                "obrigatoria": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "consentimentos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "finalidade": {
                                    "type": "string",
                                    "enum": [
                                        "tratamento_clinico",
                                        "fotografias_clinicas",
                                        "contacto",
                                        "marketing"
                                    ]
                                },
                                "texto": {
                                    "type": "string"
                                },
                                "obrigatorio": {
                                    "type": "boolean"
                                },
                                "valor": {
                                    "const": false
                                }
                            }
                        }
                    },
                    "limites": {
                        "type": "object",
                        "properties": {
                            "fotos_min": {
                                "type": "integer"
                            },
                            "fotos_max": {
                                "type": "integer"
                            },
                            "max_mb": {
                                "type": "integer",
                                "x-unidade": "MB"
                            }
                        }
                    },
                    "sucesso": {
                        "type": "object",
                        "properties": {
                            "titulo": {
                                "type": "string"
                            },
                            "texto": {
                                "type": "string"
                            }
                        }
                    },
                    "selo": {
                        "type": "string",
                        "description": "Time seal to send back (_selo)."
                    },
                    "armadilha": {
                        "type": "string",
                        "description": "Name of the trap field that must be sent empty."
                    }
                }
            },
            "PreAvaliacaoDetalhe": {
                "type": "object",
                "description": "Online assessment for review. fotos requires ficha.fotografias; answers, triage and medical note require ficha.clinica. Read is audited.",
                "x-anagen-clinico": true,
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "telefone": {
                        "type": "string"
                    },
                    "pais": {
                        "type": "string"
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "idioma": {
                        "type": "string"
                    },
                    "origem": {
                        "type": "string",
                        "enum": [
                            "site",
                            "app"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "recebida",
                            "em_revisao",
                            "revista",
                            "respondida"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "procedimento": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "procedimento_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "triagem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "elegivel_provavel",
                            "avaliar",
                            "nao_elegivel_provavel",
                            null
                        ]
                    },
                    "triagem_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "parecer": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "consulta",
                            "teleconsulta",
                            "mais_fotos",
                            "nao_elegivel",
                            "outro",
                            null
                        ]
                    },
                    "parecer_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "nota_medica": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "consentimentos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "boolean"
                        }
                    },
                    "fotos": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "ficheiro_id": {
                                    "type": "integer"
                                },
                                "vista": {
                                    "type": "string"
                                },
                                "url": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "description": "Temporary link (30 min)."
                                }
                            }
                        }
                    },
                    "respostas": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "items": {
                            "type": "object",
                            "properties": {
                                "chave": {
                                    "type": "string"
                                },
                                "rotulo": {
                                    "type": "string"
                                },
                                "valor": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "revisto_por": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "revisto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "respondido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "pode": {
                        "type": "object",
                        "properties": {
                            "rever": {
                                "type": "boolean"
                            },
                            "responder": {
                                "type": "boolean"
                            },
                            "fotos": {
                                "type": "boolean"
                            },
                            "respostas": {
                                "type": "boolean"
                            }
                        }
                    },
                    "email_enviado": {
                        "type": "boolean",
                        "description": "Only in the POST …/resposta response."
                    }
                }
            },
            "ApresentacaoConteudo": {
                "type": "object",
                "description": "Full AnagenSys presentation content in one language (sections → blocks).",
                "properties": {
                    "idioma": {
                        "type": "string",
                        "enum": [
                            "pt",
                            "en"
                        ]
                    },
                    "seccoes": {
                        "type": "object",
                        "description": "hero, numeros, jornada, funcionalidades, motor, conformidade, ia, plataformas, integracoes, diferenciacao, fases, faq, pedido. Each section is a key → value object (text, list, HTML, link {texto,url} or image {id,url,alt}).",
                        "additionalProperties": {
                            "type": "object"
                        }
                    },
                    "formulario": {
                        "type": "object",
                        "properties": {
                            "especialidades": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "valor": {
                                            "type": "string"
                                        },
                                        "rotulo": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "paises": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "valor": {
                                            "type": "string",
                                            "pattern": "^[A-Z]{2}$"
                                        },
                                        "rotulo": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "meta": {
                        "type": "object",
                        "properties": {
                            "titulo": {
                                "type": "string"
                            },
                            "descricao": {
                                "type": "string"
                            },
                            "imagem": {
                                "type": "string"
                            }
                        }
                    },
                    "urls": {
                        "type": "object",
                        "properties": {
                            "pt": {
                                "type": "string"
                            },
                            "en": {
                                "type": "string"
                            },
                            "pdf": {
                                "type": "string"
                            },
                            "desenvolvedores": {
                                "type": "string"
                            }
                        }
                    },
                    "selo": {
                        "type": "string"
                    },
                    "armadilha": {
                        "type": "string"
                    }
                }
            },
            "ApresentacaoPedidoCartao": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "nome": {
                        "type": "string"
                    },
                    "clinica_nome": {
                        "type": "string"
                    },
                    "especialidade": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "especialidade_rotulo": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "pais": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "cirurgias_mes": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "novo",
                            "contactado",
                            "demonstracao_marcada",
                            "proposta",
                            "ganho",
                            "perdido",
                            "arquivado"
                        ]
                    },
                    "estado_rotulo": {
                        "type": "string"
                    },
                    "tom": {
                        "type": "string",
                        "enum": [
                            "info",
                            "neutro",
                            "marca",
                            "ouro",
                            "sucesso",
                            "perigo"
                        ]
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "responsavel_nome": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "demonstracao_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "criado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "ordem": {
                        "type": "integer"
                    }
                }
            },
            "ApresentacaoPedido": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ApresentacaoPedidoCartao"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "cargo": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "email": {
                                "type": "string"
                            },
                            "telefone": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "cirurgioes_n": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "sistemas_atuais": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "mensagem": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "idioma": {
                                "type": "string"
                            },
                            "origem": {
                                "type": "string",
                                "enum": [
                                    "site",
                                    "app"
                                ]
                            },
                            "utm": {
                                "type": "object",
                                "additionalProperties": {
                                    "type": "string"
                                }
                            },
                            "consentimento_em": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "notas": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "responsaveis": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "nome": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "estados": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "valor": {
                                            "type": "string"
                                        },
                                        "rotulo": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                ]
            },
            "Recurso_academia_certificados": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Code",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "curso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Course",
                        "x-anagen-recurso": "academia_cursos",
                        "readOnly": true
                    },
                    "nota": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Score",
                        "x-unidade": "%",
                        "readOnly": true
                    },
                    "emitido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Issued on",
                        "readOnly": true
                    },
                    "valido_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until",
                        "readOnly": true
                    },
                    "revogado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Revoked on",
                        "readOnly": true
                    },
                    "motivo_revogacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-clinico": false
            },
            "Recurso_academia_certificados_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_academia_cursos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 190
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "maxLength": 500
                    },
                    "categoria": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Category",
                        "description": "Clinical cases: use only images and text without data that identify the patient.",
                        "enum": [
                            "normas_captura",
                            "casos_clinicos",
                            "protecao_dados",
                            "atendimento",
                            "seguranca",
                            "procedimentos",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "normas_captura": "3D capture and photography standards",
                            "casos_clinicos": "Clinical cases (anonymised)",
                            "protecao_dados": "Data protection",
                            "atendimento": "Patient service",
                            "seguranca": "Patient safety",
                            "procedimentos": "Internal procedures",
                            "outro": "Other topics"
                        },
                        "default": "outro"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description"
                    },
                    "capa_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Cover image"
                    },
                    "duracao_minutos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Duration",
                        "maximum": 6000,
                        "minimum": 1,
                        "x-unidade": "min"
                    },
                    "nota_minima": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Pass mark",
                        "maximum": 100,
                        "minimum": 0,
                        "x-unidade": "%",
                        "default": 80
                    },
                    "validade_meses": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Certificate validity (months)",
                        "description": "Empty = no expiry. Useful for recurring training (e.g. data protection every year).",
                        "maximum": 120,
                        "minimum": 1
                    },
                    "perfis": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "administracao",
                                "medico",
                                "enfermagem",
                                "tecnico",
                                "comercial",
                                "rececao"
                            ]
                        },
                        "title": "Roles",
                        "description": "Empty = whole team.",
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Doctors",
                            "enfermagem": "Nursing",
                            "tecnico": "Technicians",
                            "comercial": "Sales",
                            "rececao": "Front desk"
                        }
                    },
                    "obrigatorio": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Mandatory",
                        "default": 0
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "publicado",
                            "arquivado"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "publicado": "Published",
                            "arquivado": "Archived"
                        },
                        "default": "rascunho"
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 9999,
                        "minimum": 0,
                        "default": 0
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-clinico": false
            },
            "Recurso_academia_cursos_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 190
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "maxLength": 500
                    },
                    "categoria": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Category",
                        "description": "Clinical cases: use only images and text without data that identify the patient.",
                        "enum": [
                            "normas_captura",
                            "casos_clinicos",
                            "protecao_dados",
                            "atendimento",
                            "seguranca",
                            "procedimentos",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "normas_captura": "3D capture and photography standards",
                            "casos_clinicos": "Clinical cases (anonymised)",
                            "protecao_dados": "Data protection",
                            "atendimento": "Patient service",
                            "seguranca": "Patient safety",
                            "procedimentos": "Internal procedures",
                            "outro": "Other topics"
                        },
                        "default": "outro"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description"
                    },
                    "capa_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Cover image"
                    },
                    "duracao_minutos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Duration",
                        "maximum": 6000,
                        "minimum": 1,
                        "x-unidade": "min"
                    },
                    "nota_minima": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Pass mark",
                        "maximum": 100,
                        "minimum": 0,
                        "x-unidade": "%",
                        "default": 80
                    },
                    "validade_meses": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Certificate validity (months)",
                        "description": "Empty = no expiry. Useful for recurring training (e.g. data protection every year).",
                        "maximum": 120,
                        "minimum": 1
                    },
                    "perfis": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "administracao",
                                "medico",
                                "enfermagem",
                                "tecnico",
                                "comercial",
                                "rececao"
                            ]
                        },
                        "title": "Roles",
                        "description": "Empty = whole team.",
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Doctors",
                            "enfermagem": "Nursing",
                            "tecnico": "Technicians",
                            "comercial": "Sales",
                            "rececao": "Front desk"
                        }
                    },
                    "obrigatorio": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Mandatory",
                        "default": 0
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "publicado",
                            "arquivado"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "publicado": "Published",
                            "arquivado": "Archived"
                        },
                        "default": "rascunho"
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 9999,
                        "minimum": 0,
                        "default": 0
                    }
                },
                "required": [
                    "titulo",
                    "categoria"
                ]
            },
            "Recurso_academia_licoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "curso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Course",
                        "x-anagen-recurso": "academia_cursos"
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 190
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "texto",
                            "video",
                            "ficheiro"
                        ],
                        "x-enum-rotulos": {
                            "texto": "Text",
                            "video": "Video",
                            "ficheiro": "File"
                        },
                        "default": "texto"
                    },
                    "conteudo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Content",
                        "description": "Lesson text. Also supports the video."
                    },
                    "video_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Video"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Supporting file"
                    },
                    "duracao_minutos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Duration",
                        "maximum": 600,
                        "minimum": 1,
                        "x-unidade": "min"
                    },
                    "obrigatoria": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Required before the test",
                        "default": 1
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 9999,
                        "minimum": 0,
                        "default": 0
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-clinico": false
            },
            "Recurso_academia_licoes_Entrada": {
                "type": "object",
                "properties": {
                    "curso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Course",
                        "x-anagen-recurso": "academia_cursos"
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 190
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "texto",
                            "video",
                            "ficheiro"
                        ],
                        "x-enum-rotulos": {
                            "texto": "Text",
                            "video": "Video",
                            "ficheiro": "File"
                        },
                        "default": "texto"
                    },
                    "conteudo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Content",
                        "description": "Lesson text. Also supports the video."
                    },
                    "video_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Video"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Supporting file"
                    },
                    "duracao_minutos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Duration",
                        "maximum": 600,
                        "minimum": 1,
                        "x-unidade": "min"
                    },
                    "obrigatoria": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Required before the test",
                        "default": 1
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 9999,
                        "minimum": 0,
                        "default": 0
                    }
                },
                "required": [
                    "curso_id",
                    "titulo"
                ]
            },
            "Recurso_academia_percursos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 190
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "maxLength": 1000
                    },
                    "perfis": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "administracao",
                                "medico",
                                "enfermagem",
                                "tecnico",
                                "comercial",
                                "rececao"
                            ]
                        },
                        "title": "Roles",
                        "description": "Empty = whole team.",
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Doctors",
                            "enfermagem": "Nursing",
                            "tecnico": "Technicians",
                            "comercial": "Sales",
                            "rececao": "Front desk"
                        }
                    },
                    "cursos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Courses",
                        "x-anagen-recurso": "academia_cursos"
                    },
                    "obrigatorio": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Mandatory",
                        "default": 1
                    },
                    "prazo_dias": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Deadline (days)",
                        "description": "Days to complete, counted from the person’s start date or the path creation.",
                        "maximum": 730,
                        "minimum": 1,
                        "x-unidade": "dias"
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-clinico": false
            },
            "Recurso_academia_percursos_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 190
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "maxLength": 1000
                    },
                    "perfis": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "administracao",
                                "medico",
                                "enfermagem",
                                "tecnico",
                                "comercial",
                                "rececao"
                            ]
                        },
                        "title": "Roles",
                        "description": "Empty = whole team.",
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Doctors",
                            "enfermagem": "Nursing",
                            "tecnico": "Technicians",
                            "comercial": "Sales",
                            "rececao": "Front desk"
                        }
                    },
                    "cursos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Courses",
                        "x-anagen-recurso": "academia_cursos"
                    },
                    "obrigatorio": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Mandatory",
                        "default": 1
                    },
                    "prazo_dias": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Deadline (days)",
                        "description": "Days to complete, counted from the person’s start date or the path creation.",
                        "maximum": 730,
                        "minimum": 1,
                        "x-unidade": "dias"
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "titulo",
                    "cursos"
                ]
            },
            "Recurso_academia_perguntas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "curso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Course",
                        "x-anagen-recurso": "academia_cursos"
                    },
                    "enunciado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Question",
                        "maxLength": 1000
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "unica",
                            "multipla",
                            "verdadeiro_falso"
                        ],
                        "x-enum-rotulos": {
                            "unica": "One correct answer",
                            "multipla": "Several correct answers",
                            "verdadeiro_falso": "True or false"
                        },
                        "default": "unica"
                    },
                    "opcoes_texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Options",
                        "description": "One option per line. Start the correct one(s) with *. True/false may be left empty.",
                        "maxLength": 3000
                    },
                    "explicacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Explanation",
                        "description": "Shown after the test is submitted.",
                        "maxLength": 1000
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 9999,
                        "minimum": 0,
                        "default": 0
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-clinico": false
            },
            "Recurso_academia_perguntas_Entrada": {
                "type": "object",
                "properties": {
                    "curso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Course",
                        "x-anagen-recurso": "academia_cursos"
                    },
                    "enunciado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Question",
                        "maxLength": 1000
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "unica",
                            "multipla",
                            "verdadeiro_falso"
                        ],
                        "x-enum-rotulos": {
                            "unica": "One correct answer",
                            "multipla": "Several correct answers",
                            "verdadeiro_falso": "True or false"
                        },
                        "default": "unica"
                    },
                    "opcoes_texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Options",
                        "description": "One option per line. Start the correct one(s) with *. True/false may be left empty.",
                        "maxLength": 3000
                    },
                    "explicacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Explanation",
                        "description": "Shown after the test is submitted.",
                        "maxLength": 1000
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 9999,
                        "minimum": 0,
                        "default": 0
                    }
                },
                "required": [
                    "curso_id",
                    "enunciado"
                ]
            },
            "Recurso_acessos_emergencia": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Requested by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start",
                        "readOnly": true
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "End",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "ativo",
                            "expirado",
                            "revisto"
                        ],
                        "x-enum-rotulos": {
                            "ativo": "Active",
                            "expirado": "Pending review",
                            "revisto": "Reviewed"
                        },
                        "readOnly": true
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason",
                        "readOnly": true
                    },
                    "decisao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Decision",
                        "enum": [
                            "justificado",
                            "injustificado"
                        ],
                        "x-enum-rotulos": {
                            "justificado": "Justified",
                            "injustificado": "Unjustified"
                        },
                        "readOnly": true
                    },
                    "revisto_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Reviewed by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "revisto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Reviewed on",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Review notes",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-clinico": false
            },
            "Recurso_acessos_emergencia_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_agente_pedidos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "voz",
                            "whatsapp",
                            "chat"
                        ],
                        "x-enum-rotulos": {
                            "voz": "Voice",
                            "whatsapp": "WhatsApp",
                            "chat": "Website chat"
                        },
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "marcacao",
                            "informacao",
                            "pos_operatorio",
                            "pagamento",
                            "alarme",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "marcacao": "Booking",
                            "informacao": "Information",
                            "pos_operatorio": "Post-operative",
                            "pagamento": "Payment",
                            "alarme": "Red flag",
                            "outro": "Other"
                        },
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "ia_a_tratar",
                            "passado_equipa",
                            "resolvido",
                            "validado"
                        ],
                        "x-enum-rotulos": {
                            "ia_a_tratar": "AI handling",
                            "passado_equipa": "With the team",
                            "resolvido": "Resolved",
                            "validado": "Validated"
                        },
                        "readOnly": true
                    },
                    "sinal_alarme": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Red flag",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "x-anagen-recurso": "leads",
                        "readOnly": true
                    },
                    "intencao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Intent",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "proximo_passo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Next step",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "x-anagen-cifrado": "geral",
                        "readOnly": true
                    },
                    "transcricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Transcript",
                        "x-anagen-permissao": "ficha.clinica",
                        "x-anagen-cifrado": "geral",
                        "readOnly": true
                    },
                    "notas_relatadas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes reported by the patient",
                        "x-anagen-permissao": "ficha.clinica",
                        "x-anagen-cifrado": "geral",
                        "readOnly": true
                    },
                    "duracao_s": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Duration",
                        "x-unidade": "s",
                        "readOnly": true
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "aviso_ia": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "AI notice given",
                        "readOnly": true
                    },
                    "identificacao_verificada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Identity verified",
                        "readOnly": true
                    },
                    "amostra": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Review sample",
                        "readOnly": true
                    },
                    "revisao_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Review",
                        "enum": [
                            "conforme",
                            "a_corrigir"
                        ],
                        "x-enum-rotulos": {
                            "conforme": "Compliant",
                            "a_corrigir": "Needs correction"
                        },
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-clinico": false
            },
            "Recurso_agente_pedidos_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_agente_testes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 160
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "voz",
                            "escrito"
                        ],
                        "x-enum-rotulos": {
                            "voz": "Voice",
                            "escrito": "Written"
                        },
                        "default": "voz"
                    },
                    "lingua": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "turnos": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Turns",
                        "description": "List of {\"papel\": \"pessoa\" or \"agente\", \"texto\"}; the last one is from the person contacting."
                    },
                    "esperado": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Expected",
                        "description": "{\"deve_conter\": [], \"nao_deve_conter\": [], \"passar_equipa\": true|false|null, \"sinal_alarme\": true|false|null, \"tipo\": null}."
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": true
                    },
                    "ultimo_resultado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Last result",
                        "enum": [
                            "passou",
                            "falhou"
                        ],
                        "x-enum-rotulos": {
                            "passou": "Passed",
                            "falhou": "Failed"
                        },
                        "readOnly": true
                    },
                    "origem_pedido_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Created from",
                        "x-anagen-recurso": "agente_pedidos",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-clinico": false
            },
            "Recurso_agente_testes_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 160
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "voz",
                            "escrito"
                        ],
                        "x-enum-rotulos": {
                            "voz": "Voice",
                            "escrito": "Written"
                        },
                        "default": "voz"
                    },
                    "lingua": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "turnos": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Turns",
                        "description": "List of {\"papel\": \"pessoa\" or \"agente\", \"texto\"}; the last one is from the person contacting."
                    },
                    "esperado": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Expected",
                        "description": "{\"deve_conter\": [], \"nao_deve_conter\": [], \"passar_equipa\": true|false|null, \"sinal_alarme\": true|false|null, \"tipo\": null}."
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": true
                    }
                },
                "required": [
                    "titulo",
                    "turnos"
                ]
            },
            "Recurso_alertas_acesso": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "volume",
                            "fora_horas",
                            "emergencia_repetida",
                            "exportacao_volumosa",
                            "falhas_entrada",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "volume": "Unusual volume",
                            "fora_horas": "Out of hours",
                            "emergencia_repetida": "Repeated emergency access",
                            "exportacao_volumosa": "Large export",
                            "falhas_entrada": "Sign-in failures",
                            "outro": "Other"
                        },
                        "readOnly": true
                    },
                    "gravidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Severity",
                        "enum": [
                            "baixa",
                            "media",
                            "alta"
                        ],
                        "x-enum-rotulos": {
                            "baixa": "Low",
                            "media": "Medium",
                            "alta": "High"
                        },
                        "readOnly": true
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "detetado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Detected on",
                        "readOnly": true
                    },
                    "janela_inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Period start",
                        "readOnly": true
                    },
                    "janela_fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Period end",
                        "readOnly": true
                    },
                    "dados": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Detail",
                        "readOnly": true
                    },
                    "decisao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Decision",
                        "enum": [
                            "justificado",
                            "injustificado",
                            "falso_positivo"
                        ],
                        "x-enum-rotulos": {
                            "justificado": "Justified",
                            "injustificado": "Unjustified",
                            "falso_positivo": "False positive"
                        },
                        "readOnly": true
                    },
                    "revisto_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Reviewed by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "revisto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Reviewed on",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.auditoria",
                "x-anagen-clinico": false
            },
            "Recurso_alertas_acesso_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_api_clientes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 500
                    },
                    "client_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Identifier",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "segredo_prefixo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Secret prefix",
                        "description": "To recognise which secret is in use.",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "segredo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Secret",
                        "description": "Copy it now: for security, it will not be shown again.",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "ambitos": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "clinico.parametros:ver",
                                "clinico.parametros:editar",
                                "ficha.identificacao:ver",
                                "ficha.identificacao:editar",
                                "ficha.consentimentos:ver",
                                "ficha.consentimentos:editar",
                                "ficha.clinica:ver",
                                "ficha.clinica:editar",
                                "ficha.captura:ver",
                                "ficha.captura:editar",
                                "ficha.fotografias:ver",
                                "ficha.fotografias:editar",
                                "ficha.plano:ver",
                                "ficha.plano:editar",
                                "crm.leads:ver",
                                "crm.leads:editar",
                                "crm.atendimento:ver",
                                "crm.atendimento:editar",
                                "crm.telefonia:ver",
                                "crm.telefonia:editar",
                                "crm.agente:ver",
                                "crm.agente:editar",
                                "marketing:ver",
                                "marketing:editar",
                                "agenda:ver",
                                "agenda:editar",
                                "teleconsulta:ver",
                                "teleconsulta:editar",
                                "bloco.mapa:ver",
                                "bloco.mapa:editar",
                                "bloco.marcar:ver",
                                "bloco.marcar:editar",
                                "bloco.registo:ver",
                                "bloco.registo:editar",
                                "acompanhamento:ver",
                                "acompanhamento:editar",
                                "comercial.propostas:ver",
                                "comercial.propostas:editar",
                                "comercial.descontos:ver",
                                "comercial.descontos:editar",
                                "financeiro.pagamentos:ver",
                                "financeiro.pagamentos:editar",
                                "financeiro.valores:ver",
                                "financeiro.valores:editar",
                                "stock:ver",
                                "stock:editar",
                                "documentos:ver",
                                "documentos:editar",
                                "conformidade:ver",
                                "conformidade:editar",
                                "equipa.tarefas:ver",
                                "equipa.tarefas:editar",
                                "equipa.chat:ver",
                                "equipa.chat:editar",
                                "indicadores.financeiros:ver",
                                "indicadores.financeiros:editar",
                                "indicadores.vendas:ver",
                                "indicadores.vendas:editar",
                                "indicadores.operacionais:ver",
                                "indicadores.operacionais:editar",
                                "indicadores.atendimento:ver",
                                "indicadores.atendimento:editar",
                                "site.cms:ver",
                                "site.cms:editar"
                            ]
                        },
                        "title": "Authorisations",
                        "description": "What this client can view or change, module by module.",
                        "x-enum-rotulos": {
                            "clinico.parametros:ver": "Parâmetros clínicos · Ver",
                            "clinico.parametros:editar": "Parâmetros clínicos · Editar",
                            "ficha.identificacao:ver": "Identificação do paciente · Ver",
                            "ficha.identificacao:editar": "Identificação do paciente · Editar",
                            "ficha.consentimentos:ver": "Consentimentos · Ver",
                            "ficha.consentimentos:editar": "Consentimentos · Editar",
                            "ficha.clinica:ver": "Ficha clínica · Ver",
                            "ficha.clinica:editar": "Ficha clínica · Editar",
                            "ficha.captura:ver": "Captura e tricoscopia · Ver",
                            "ficha.captura:editar": "Captura e tricoscopia · Editar",
                            "ficha.fotografias:ver": "Fotografias clínicas · Ver",
                            "ficha.fotografias:editar": "Fotografias clínicas · Editar",
                            "ficha.plano:ver": "Plano cirúrgico · Ver",
                            "ficha.plano:editar": "Plano cirúrgico · Editar",
                            "crm.leads:ver": "Leads e funil · Ver",
                            "crm.leads:editar": "Leads e funil · Editar",
                            "crm.atendimento:ver": "Atendimento · Ver",
                            "crm.atendimento:editar": "Atendimento · Editar",
                            "crm.telefonia:ver": "Telefonia · Ver",
                            "crm.telefonia:editar": "Telefonia · Editar",
                            "crm.agente:ver": "Agente de conversação · Ver",
                            "crm.agente:editar": "Agente de conversação · Editar",
                            "marketing:ver": "Marketing · Ver",
                            "marketing:editar": "Marketing · Editar",
                            "agenda:ver": "Agenda · Ver",
                            "agenda:editar": "Agenda · Editar",
                            "teleconsulta:ver": "Teleconsulta · Ver",
                            "teleconsulta:editar": "Teleconsulta · Editar",
                            "bloco.mapa:ver": "Mapa de cirurgias · Ver",
                            "bloco.mapa:editar": "Mapa de cirurgias · Editar",
                            "bloco.marcar:ver": "Marcação de cirurgias · Ver",
                            "bloco.marcar:editar": "Marcação de cirurgias · Editar",
                            "bloco.registo:ver": "Registo cirúrgico · Ver",
                            "bloco.registo:editar": "Registo cirúrgico · Editar",
                            "acompanhamento:ver": "Acompanhamento · Ver",
                            "acompanhamento:editar": "Acompanhamento · Editar",
                            "comercial.propostas:ver": "Propostas · Ver",
                            "comercial.propostas:editar": "Propostas · Editar",
                            "comercial.descontos:ver": "Descontos · Ver",
                            "comercial.descontos:editar": "Descontos · Editar",
                            "financeiro.pagamentos:ver": "Pagamentos · Ver",
                            "financeiro.pagamentos:editar": "Pagamentos · Editar",
                            "financeiro.valores:ver": "Valores e comissões · Ver",
                            "financeiro.valores:editar": "Valores e comissões · Editar",
                            "stock:ver": "Stock · Ver",
                            "stock:editar": "Stock · Editar",
                            "documentos:ver": "Documentos · Ver",
                            "documentos:editar": "Documentos · Editar",
                            "conformidade:ver": "Conformidade · Ver",
                            "conformidade:editar": "Conformidade · Editar",
                            "equipa.tarefas:ver": "Tarefas · Ver",
                            "equipa.tarefas:editar": "Tarefas · Editar",
                            "equipa.chat:ver": "Conversas da equipa · Ver",
                            "equipa.chat:editar": "Conversas da equipa · Editar",
                            "indicadores.financeiros:ver": "Indicadores financeiros · Ver",
                            "indicadores.financeiros:editar": "Indicadores financeiros · Editar",
                            "indicadores.vendas:ver": "Indicadores de vendas · Ver",
                            "indicadores.vendas:editar": "Indicadores de vendas · Editar",
                            "indicadores.operacionais:ver": "Indicadores operacionais · Ver",
                            "indicadores.operacionais:editar": "Indicadores operacionais · Editar",
                            "indicadores.atendimento:ver": "Indicadores de atendimento · Ver",
                            "indicadores.atendimento:editar": "Indicadores de atendimento · Editar",
                            "site.cms:ver": "Site e conteúdos · Ver",
                            "site.cms:editar": "Site e conteúdos · Editar"
                        }
                    },
                    "limite_minuto": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Request limit per minute",
                        "description": "Above this value, requests are temporarily refused.",
                        "maximum": 6000,
                        "minimum": 10,
                        "default": 120
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until",
                        "description": "Optional. After this date the client stops working."
                    },
                    "ip_permitidos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Allowed source networks",
                        "description": "Optional. One per line: address or network.",
                        "maxLength": 2000
                    },
                    "origens": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Allowed browser origins",
                        "description": "Only for integrations that run in a browser. One per line (https://example.com).",
                        "maxLength": 2000
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Owner",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "justificacao_clinica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical justification",
                        "description": "Required for authorisations with clinical content; needs approval from the clinical director.",
                        "maxLength": 4000
                    },
                    "justificacao_aprovada_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Approved by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "justificacao_aprovada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Approved on",
                        "readOnly": true
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "ultimo_uso_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last used",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-clinico": false
            },
            "Recurso_api_clientes_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 500
                    },
                    "ambitos": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "clinico.parametros:ver",
                                "clinico.parametros:editar",
                                "ficha.identificacao:ver",
                                "ficha.identificacao:editar",
                                "ficha.consentimentos:ver",
                                "ficha.consentimentos:editar",
                                "ficha.clinica:ver",
                                "ficha.clinica:editar",
                                "ficha.captura:ver",
                                "ficha.captura:editar",
                                "ficha.fotografias:ver",
                                "ficha.fotografias:editar",
                                "ficha.plano:ver",
                                "ficha.plano:editar",
                                "crm.leads:ver",
                                "crm.leads:editar",
                                "crm.atendimento:ver",
                                "crm.atendimento:editar",
                                "crm.telefonia:ver",
                                "crm.telefonia:editar",
                                "crm.agente:ver",
                                "crm.agente:editar",
                                "marketing:ver",
                                "marketing:editar",
                                "agenda:ver",
                                "agenda:editar",
                                "teleconsulta:ver",
                                "teleconsulta:editar",
                                "bloco.mapa:ver",
                                "bloco.mapa:editar",
                                "bloco.marcar:ver",
                                "bloco.marcar:editar",
                                "bloco.registo:ver",
                                "bloco.registo:editar",
                                "acompanhamento:ver",
                                "acompanhamento:editar",
                                "comercial.propostas:ver",
                                "comercial.propostas:editar",
                                "comercial.descontos:ver",
                                "comercial.descontos:editar",
                                "financeiro.pagamentos:ver",
                                "financeiro.pagamentos:editar",
                                "financeiro.valores:ver",
                                "financeiro.valores:editar",
                                "stock:ver",
                                "stock:editar",
                                "documentos:ver",
                                "documentos:editar",
                                "conformidade:ver",
                                "conformidade:editar",
                                "equipa.tarefas:ver",
                                "equipa.tarefas:editar",
                                "equipa.chat:ver",
                                "equipa.chat:editar",
                                "indicadores.financeiros:ver",
                                "indicadores.financeiros:editar",
                                "indicadores.vendas:ver",
                                "indicadores.vendas:editar",
                                "indicadores.operacionais:ver",
                                "indicadores.operacionais:editar",
                                "indicadores.atendimento:ver",
                                "indicadores.atendimento:editar",
                                "site.cms:ver",
                                "site.cms:editar"
                            ]
                        },
                        "title": "Authorisations",
                        "description": "What this client can view or change, module by module.",
                        "x-enum-rotulos": {
                            "clinico.parametros:ver": "Parâmetros clínicos · Ver",
                            "clinico.parametros:editar": "Parâmetros clínicos · Editar",
                            "ficha.identificacao:ver": "Identificação do paciente · Ver",
                            "ficha.identificacao:editar": "Identificação do paciente · Editar",
                            "ficha.consentimentos:ver": "Consentimentos · Ver",
                            "ficha.consentimentos:editar": "Consentimentos · Editar",
                            "ficha.clinica:ver": "Ficha clínica · Ver",
                            "ficha.clinica:editar": "Ficha clínica · Editar",
                            "ficha.captura:ver": "Captura e tricoscopia · Ver",
                            "ficha.captura:editar": "Captura e tricoscopia · Editar",
                            "ficha.fotografias:ver": "Fotografias clínicas · Ver",
                            "ficha.fotografias:editar": "Fotografias clínicas · Editar",
                            "ficha.plano:ver": "Plano cirúrgico · Ver",
                            "ficha.plano:editar": "Plano cirúrgico · Editar",
                            "crm.leads:ver": "Leads e funil · Ver",
                            "crm.leads:editar": "Leads e funil · Editar",
                            "crm.atendimento:ver": "Atendimento · Ver",
                            "crm.atendimento:editar": "Atendimento · Editar",
                            "crm.telefonia:ver": "Telefonia · Ver",
                            "crm.telefonia:editar": "Telefonia · Editar",
                            "crm.agente:ver": "Agente de conversação · Ver",
                            "crm.agente:editar": "Agente de conversação · Editar",
                            "marketing:ver": "Marketing · Ver",
                            "marketing:editar": "Marketing · Editar",
                            "agenda:ver": "Agenda · Ver",
                            "agenda:editar": "Agenda · Editar",
                            "teleconsulta:ver": "Teleconsulta · Ver",
                            "teleconsulta:editar": "Teleconsulta · Editar",
                            "bloco.mapa:ver": "Mapa de cirurgias · Ver",
                            "bloco.mapa:editar": "Mapa de cirurgias · Editar",
                            "bloco.marcar:ver": "Marcação de cirurgias · Ver",
                            "bloco.marcar:editar": "Marcação de cirurgias · Editar",
                            "bloco.registo:ver": "Registo cirúrgico · Ver",
                            "bloco.registo:editar": "Registo cirúrgico · Editar",
                            "acompanhamento:ver": "Acompanhamento · Ver",
                            "acompanhamento:editar": "Acompanhamento · Editar",
                            "comercial.propostas:ver": "Propostas · Ver",
                            "comercial.propostas:editar": "Propostas · Editar",
                            "comercial.descontos:ver": "Descontos · Ver",
                            "comercial.descontos:editar": "Descontos · Editar",
                            "financeiro.pagamentos:ver": "Pagamentos · Ver",
                            "financeiro.pagamentos:editar": "Pagamentos · Editar",
                            "financeiro.valores:ver": "Valores e comissões · Ver",
                            "financeiro.valores:editar": "Valores e comissões · Editar",
                            "stock:ver": "Stock · Ver",
                            "stock:editar": "Stock · Editar",
                            "documentos:ver": "Documentos · Ver",
                            "documentos:editar": "Documentos · Editar",
                            "conformidade:ver": "Conformidade · Ver",
                            "conformidade:editar": "Conformidade · Editar",
                            "equipa.tarefas:ver": "Tarefas · Ver",
                            "equipa.tarefas:editar": "Tarefas · Editar",
                            "equipa.chat:ver": "Conversas da equipa · Ver",
                            "equipa.chat:editar": "Conversas da equipa · Editar",
                            "indicadores.financeiros:ver": "Indicadores financeiros · Ver",
                            "indicadores.financeiros:editar": "Indicadores financeiros · Editar",
                            "indicadores.vendas:ver": "Indicadores de vendas · Ver",
                            "indicadores.vendas:editar": "Indicadores de vendas · Editar",
                            "indicadores.operacionais:ver": "Indicadores operacionais · Ver",
                            "indicadores.operacionais:editar": "Indicadores operacionais · Editar",
                            "indicadores.atendimento:ver": "Indicadores de atendimento · Ver",
                            "indicadores.atendimento:editar": "Indicadores de atendimento · Editar",
                            "site.cms:ver": "Site e conteúdos · Ver",
                            "site.cms:editar": "Site e conteúdos · Editar"
                        }
                    },
                    "limite_minuto": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Request limit per minute",
                        "description": "Above this value, requests are temporarily refused.",
                        "maximum": 6000,
                        "minimum": 10,
                        "default": 120
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until",
                        "description": "Optional. After this date the client stops working."
                    },
                    "ip_permitidos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Allowed source networks",
                        "description": "Optional. One per line: address or network.",
                        "maxLength": 2000
                    },
                    "origens": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Allowed browser origins",
                        "description": "Only for integrations that run in a browser. One per line (https://example.com).",
                        "maxLength": 2000
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Owner",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "justificacao_clinica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical justification",
                        "description": "Required for authorisations with clinical content; needs approval from the clinical director.",
                        "maxLength": 4000
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "ambitos"
                ]
            },
            "Recurso_artigos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "referencia": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reference",
                        "maxLength": 60
                    },
                    "categoria": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Category",
                        "enum": [
                            "consumivel",
                            "farmaco",
                            "material",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "consumivel": "Consumable",
                            "farmaco": "Medication",
                            "material": "Supplies",
                            "outro": "Other"
                        },
                        "default": "consumivel"
                    },
                    "unidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Unit",
                        "description": "E.g. unit, box, ml, vial.",
                        "maxLength": 20,
                        "default": "un"
                    },
                    "stock_atual": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Current stock",
                        "x-casas": 3,
                        "readOnly": true
                    },
                    "stock_minimo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Minimum stock",
                        "minimum": 0,
                        "x-casas": 3,
                        "default": 0
                    },
                    "stock_inicial": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Opening stock",
                        "description": "Quantity on hand when the item is created (recorded as stock in).",
                        "minimum": 0,
                        "x-casas": 3
                    },
                    "custo_unitario": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Unit cost",
                        "description": "Weighted average cost, updated with every stock in that has a cost.",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 4
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Usual supplier",
                        "maxLength": 160
                    },
                    "localizacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Location",
                        "maxLength": 80
                    },
                    "lote_obrigatorio": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires batch",
                        "description": "Movements of this item must state the batch (and the expiry date).",
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-clinico": false
            },
            "Recurso_artigos_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "referencia": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reference",
                        "maxLength": 60
                    },
                    "categoria": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Category",
                        "enum": [
                            "consumivel",
                            "farmaco",
                            "material",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "consumivel": "Consumable",
                            "farmaco": "Medication",
                            "material": "Supplies",
                            "outro": "Other"
                        },
                        "default": "consumivel"
                    },
                    "unidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Unit",
                        "description": "E.g. unit, box, ml, vial.",
                        "maxLength": 20,
                        "default": "un"
                    },
                    "stock_minimo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Minimum stock",
                        "minimum": 0,
                        "x-casas": 3,
                        "default": 0
                    },
                    "stock_inicial": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Opening stock",
                        "description": "Quantity on hand when the item is created (recorded as stock in).",
                        "minimum": 0,
                        "x-casas": 3
                    },
                    "custo_unitario": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Unit cost",
                        "description": "Weighted average cost, updated with every stock in that has a cost.",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 4
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Usual supplier",
                        "maxLength": 160
                    },
                    "localizacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Location",
                        "maxLength": 80
                    },
                    "lote_obrigatorio": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires batch",
                        "description": "Movements of this item must state the batch (and the expiry date).",
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    }
                },
                "required": [
                    "nome",
                    "categoria",
                    "unidade"
                ]
            },
            "Recurso_artigos_precos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "artigo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Item",
                        "x-anagen-recurso": "artigos"
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Supplier",
                        "maxLength": 160
                    },
                    "referencia_fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Supplier reference",
                        "maxLength": 60
                    },
                    "preco": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Price",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 4
                    },
                    "unidade_compra": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purchase unit",
                        "maxLength": 30
                    },
                    "quantidade_minima": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Minimum quantity",
                        "minimum": 0,
                        "x-casas": 3
                    },
                    "prazo_dias": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Lead time (days)",
                        "maximum": 365,
                        "minimum": 0,
                        "x-unidade": "dias"
                    },
                    "valido_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valido_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "preferido": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Preferred",
                        "default": 0
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-clinico": false
            },
            "Recurso_artigos_precos_Entrada": {
                "type": "object",
                "properties": {
                    "artigo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Item",
                        "x-anagen-recurso": "artigos"
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Supplier",
                        "maxLength": 160
                    },
                    "referencia_fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Supplier reference",
                        "maxLength": 60
                    },
                    "preco": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Price",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 4
                    },
                    "unidade_compra": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purchase unit",
                        "maxLength": 30
                    },
                    "quantidade_minima": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Minimum quantity",
                        "minimum": 0,
                        "x-casas": 3
                    },
                    "prazo_dias": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Lead time (days)",
                        "maximum": 365,
                        "minimum": 0,
                        "x-unidade": "dias"
                    },
                    "valido_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valido_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "preferido": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Preferred",
                        "default": 0
                    }
                },
                "required": [
                    "artigo_id",
                    "fornecedor",
                    "preco"
                ]
            },
            "Recurso_atividades_tratamento": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Activity",
                        "maxLength": 200
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purpose",
                        "maxLength": 5000
                    },
                    "base_legal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Legal basis",
                        "enum": [
                            "consentimento",
                            "prestacao_cuidados",
                            "contrato",
                            "interesse_legitimo",
                            "obrigacao_legal"
                        ],
                        "x-enum-rotulos": {
                            "consentimento": "Consent",
                            "prestacao_cuidados": "Provision of healthcare",
                            "contrato": "Performance of a contract",
                            "interesse_legitimo": "Legitimate interest",
                            "obrigacao_legal": "Legal obligation"
                        }
                    },
                    "base_legal_detalhe": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Legal basis (detail)",
                        "description": "For health data, also state the exception under Art. 9(2).",
                        "maxLength": 255
                    },
                    "categorias_dados": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "identificacao",
                                "contacto",
                                "saude",
                                "imagens",
                                "modelos_3d",
                                "gravacoes",
                                "financeiros",
                                "comportamento_site",
                                "profissionais"
                            ]
                        },
                        "title": "Data categories",
                        "x-enum-rotulos": {
                            "identificacao": "Identification",
                            "contacto": "Contact details",
                            "saude": "Health data",
                            "imagens": "Photographs and images",
                            "modelos_3d": "3D models",
                            "gravacoes": "Voice and video recordings",
                            "financeiros": "Financial data",
                            "comportamento_site": "Website browsing",
                            "profissionais": "Professionals’ data"
                        }
                    },
                    "titulares": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Categories of data subjects",
                        "maxLength": 255
                    },
                    "destinatarios": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Recipients",
                        "maxLength": 5000
                    },
                    "subcontratantes": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Processors",
                        "x-anagen-recurso": "subcontratantes"
                    },
                    "transferencias": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "International transfers",
                        "maxLength": 255
                    },
                    "prazo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Retention period",
                        "maxLength": 255
                    },
                    "medidas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Security measures",
                        "maxLength": 5000
                    },
                    "aipd_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Impact assessment",
                        "enum": [
                            "nao_necessaria",
                            "por_fazer",
                            "em_curso",
                            "feita"
                        ],
                        "x-enum-rotulos": {
                            "nao_necessaria": "Not required",
                            "por_fazer": "To do",
                            "em_curso": "In progress",
                            "feita": "Done"
                        },
                        "default": "por_fazer"
                    },
                    "aipd_data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Assessment date"
                    },
                    "modulo_sistema": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "System module",
                        "maxLength": 60
                    },
                    "dispositivo_medico": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Software as a medical device",
                        "description": "Assessment under Regulation (EU) 2017/745 for features with a medical purpose (for example, image analysis).",
                        "enum": [
                            "nao_aplicavel",
                            "por_avaliar",
                            "nao",
                            "sim"
                        ],
                        "x-enum-rotulos": {
                            "nao_aplicavel": "Not applicable",
                            "por_avaliar": "To be assessed",
                            "nao": "Not a medical device",
                            "sim": "Is a medical device"
                        },
                        "default": "nao_aplicavel"
                    },
                    "revisto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Reviewed on",
                        "readOnly": true
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "revisao_juridica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Reviewed by the DPO/legal team",
                        "description": "Tick once the data protection officer or the legal team has reviewed the text. Texts supplied with the system arrive unreviewed."
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_atividades_tratamento_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Activity",
                        "maxLength": 200
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purpose",
                        "maxLength": 5000
                    },
                    "base_legal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Legal basis",
                        "enum": [
                            "consentimento",
                            "prestacao_cuidados",
                            "contrato",
                            "interesse_legitimo",
                            "obrigacao_legal"
                        ],
                        "x-enum-rotulos": {
                            "consentimento": "Consent",
                            "prestacao_cuidados": "Provision of healthcare",
                            "contrato": "Performance of a contract",
                            "interesse_legitimo": "Legitimate interest",
                            "obrigacao_legal": "Legal obligation"
                        }
                    },
                    "base_legal_detalhe": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Legal basis (detail)",
                        "description": "For health data, also state the exception under Art. 9(2).",
                        "maxLength": 255
                    },
                    "categorias_dados": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "identificacao",
                                "contacto",
                                "saude",
                                "imagens",
                                "modelos_3d",
                                "gravacoes",
                                "financeiros",
                                "comportamento_site",
                                "profissionais"
                            ]
                        },
                        "title": "Data categories",
                        "x-enum-rotulos": {
                            "identificacao": "Identification",
                            "contacto": "Contact details",
                            "saude": "Health data",
                            "imagens": "Photographs and images",
                            "modelos_3d": "3D models",
                            "gravacoes": "Voice and video recordings",
                            "financeiros": "Financial data",
                            "comportamento_site": "Website browsing",
                            "profissionais": "Professionals’ data"
                        }
                    },
                    "titulares": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Categories of data subjects",
                        "maxLength": 255
                    },
                    "destinatarios": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Recipients",
                        "maxLength": 5000
                    },
                    "subcontratantes": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Processors",
                        "x-anagen-recurso": "subcontratantes"
                    },
                    "transferencias": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "International transfers",
                        "maxLength": 255
                    },
                    "prazo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Retention period",
                        "maxLength": 255
                    },
                    "medidas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Security measures",
                        "maxLength": 5000
                    },
                    "aipd_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Impact assessment",
                        "enum": [
                            "nao_necessaria",
                            "por_fazer",
                            "em_curso",
                            "feita"
                        ],
                        "x-enum-rotulos": {
                            "nao_necessaria": "Not required",
                            "por_fazer": "To do",
                            "em_curso": "In progress",
                            "feita": "Done"
                        },
                        "default": "por_fazer"
                    },
                    "aipd_data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Assessment date"
                    },
                    "modulo_sistema": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "System module",
                        "maxLength": 60
                    },
                    "dispositivo_medico": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Software as a medical device",
                        "description": "Assessment under Regulation (EU) 2017/745 for features with a medical purpose (for example, image analysis).",
                        "enum": [
                            "nao_aplicavel",
                            "por_avaliar",
                            "nao",
                            "sim"
                        ],
                        "x-enum-rotulos": {
                            "nao_aplicavel": "Not applicable",
                            "por_avaliar": "To be assessed",
                            "nao": "Not a medical device",
                            "sim": "Is a medical device"
                        },
                        "default": "nao_aplicavel"
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "revisao_juridica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Reviewed by the DPO/legal team",
                        "description": "Tick once the data protection officer or the legal team has reviewed the text. Texts supplied with the system arrive unreviewed."
                    }
                },
                "required": [
                    "nome",
                    "finalidade",
                    "base_legal"
                ]
            },
            "Recurso_ausencias": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "recurso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Room or equipment",
                        "x-anagen-recurso": "recursos_agenda"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "ferias",
                            "formacao",
                            "doenca",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "ferias": "Holiday",
                            "formacao": "Training",
                            "doenca": "Sick leave",
                            "outro": "Absence"
                        },
                        "default": "ferias"
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "End"
                    },
                    "aprovada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Approved",
                        "description": "Only approved absences block the schedule.",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "description": "No clinical reasons.",
                        "maxLength": 255
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-clinico": false
            },
            "Recurso_ausencias_Entrada": {
                "type": "object",
                "properties": {
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "recurso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Room or equipment",
                        "x-anagen-recurso": "recursos_agenda"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "ferias",
                            "formacao",
                            "doenca",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "ferias": "Holiday",
                            "formacao": "Training",
                            "doenca": "Sick leave",
                            "outro": "Absence"
                        },
                        "default": "ferias"
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "End"
                    },
                    "aprovada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Approved",
                        "description": "Only approved absences block the schedule.",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "description": "No clinical reasons.",
                        "maxLength": 255
                    }
                },
                "required": [
                    "tipo",
                    "inicio",
                    "fim"
                ]
            },
            "Recurso_avisos_exibicoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "mostrado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Shown on",
                        "readOnly": true
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "site",
                            "portal",
                            "agente_voz",
                            "teleconsulta",
                            "app",
                            "formulario",
                            "presencial",
                            "demonstracao"
                        ],
                        "x-enum-rotulos": {
                            "site": "Website",
                            "portal": "Patient portal",
                            "agente_voz": "Voice agent",
                            "teleconsulta": "Teleconsultation",
                            "app": "Mobile app",
                            "formulario": "Forms",
                            "presencial": "In person",
                            "demonstracao": "Demo request"
                        },
                        "readOnly": true
                    },
                    "aviso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Notice",
                        "x-anagen-recurso": "avisos_privacidade",
                        "readOnly": true
                    },
                    "aviso_versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "contexto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Where",
                        "enum": [
                            "pre_avaliacao",
                            "contacto_chamada",
                            "contacto_marcacao",
                            "contacto_reclamacao",
                            "portal_registo",
                            "portal",
                            "demonstracao",
                            "formulario",
                            "teleconsulta",
                            "agente_voz",
                            "recolha",
                            "app"
                        ],
                        "x-enum-rotulos": {
                            "pre_avaliacao": "Online assessment",
                            "contacto_chamada": "Call request",
                            "contacto_marcacao": "Appointment request",
                            "contacto_reclamacao": "Complaint, compliment or suggestion",
                            "portal_registo": "Portal sign-up",
                            "portal": "Patient portal",
                            "demonstracao": "Demo request",
                            "formulario": "Form sent by link",
                            "teleconsulta": "Teleconsultation",
                            "agente_voz": "Voice assistant call",
                            "recolha": "Consent collection",
                            "app": "App"
                        },
                        "readOnly": true
                    },
                    "meio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Medium",
                        "enum": [
                            "web",
                            "app",
                            "externo",
                            "voz",
                            "video",
                            "presencial",
                            "api"
                        ],
                        "x-enum-rotulos": {
                            "web": "Website",
                            "app": "App",
                            "externo": "External website",
                            "voz": "Call",
                            "video": "Video",
                            "presencial": "In person",
                            "api": "Integration"
                        },
                        "readOnly": true
                    },
                    "prova": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Evidence",
                        "enum": [
                            "testemunho",
                            "envio",
                            "servidor"
                        ],
                        "x-enum-rotulos": {
                            "testemunho": "Version confirmed by the form",
                            "envio": "Version in force at submission",
                            "servidor": "Shown by the flow itself"
                        },
                        "readOnly": true
                    },
                    "titular_tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Data subject",
                        "enum": [
                            "paciente",
                            "lead",
                            "portal_conta",
                            "contacto"
                        ],
                        "x-enum-rotulos": {
                            "paciente": "Patient",
                            "lead": "Sales contact",
                            "portal_conta": "Portal account",
                            "contacto": "Contact"
                        },
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Contact",
                        "x-anagen-recurso": "leads",
                        "readOnly": true
                    },
                    "portal_conta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Portal account",
                        "readOnly": true
                    },
                    "ref_tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Linked record",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "ref_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Record no.",
                        "readOnly": true
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Shown by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "registado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Recorded on",
                        "readOnly": true
                    },
                    "texto_hash": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notice text digest (SHA-256)",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "impressao_digital": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Record fingerprint",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_avisos_exibicoes_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_avisos_privacidade": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "site",
                            "portal",
                            "agente_voz",
                            "teleconsulta",
                            "app",
                            "formulario",
                            "presencial",
                            "demonstracao"
                        ],
                        "x-enum-rotulos": {
                            "site": "Website",
                            "portal": "Patient portal",
                            "agente_voz": "Voice agent",
                            "teleconsulta": "Teleconsultation",
                            "app": "Mobile app",
                            "formulario": "Forms",
                            "presencial": "In person",
                            "demonstracao": "Demo request"
                        }
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese (Portugal)",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text",
                        "description": "Controller, DPO, purposes, legal bases, recipients, retention periods and rights — with the clinic’s legal details."
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "In force",
                        "readOnly": true
                    },
                    "publicado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Published on",
                        "readOnly": true
                    },
                    "publicado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Published by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "revisao_juridica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Reviewed by the DPO/legal team",
                        "description": "Tick once the data protection officer or the legal team has reviewed the text. Texts supplied with the system arrive unreviewed."
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_avisos_privacidade_Entrada": {
                "type": "object",
                "properties": {
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "site",
                            "portal",
                            "agente_voz",
                            "teleconsulta",
                            "app",
                            "formulario",
                            "presencial",
                            "demonstracao"
                        ],
                        "x-enum-rotulos": {
                            "site": "Website",
                            "portal": "Patient portal",
                            "agente_voz": "Voice agent",
                            "teleconsulta": "Teleconsultation",
                            "app": "Mobile app",
                            "formulario": "Forms",
                            "presencial": "In person",
                            "demonstracao": "Demo request"
                        }
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese (Portugal)",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text",
                        "description": "Controller, DPO, purposes, legal bases, recipients, retention periods and rights — with the clinic’s legal details."
                    },
                    "revisao_juridica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Reviewed by the DPO/legal team",
                        "description": "Tick once the data protection officer or the legal team has reviewed the text. Texts supplied with the system arrive unreviewed."
                    }
                },
                "required": [
                    "canal",
                    "titulo",
                    "idioma",
                    "texto"
                ]
            },
            "Recurso_base_conhecimento": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 190
                    },
                    "categoria": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Category",
                        "enum": [
                            "horario",
                            "localizacao",
                            "consulta",
                            "procedimentos",
                            "pos_operatorio",
                            "pagamentos",
                            "geral",
                            "correcao"
                        ],
                        "x-enum-rotulos": {
                            "horario": "Opening hours",
                            "localizacao": "Location",
                            "consulta": "Consultation",
                            "procedimentos": "Procedures",
                            "pos_operatorio": "Post-operative",
                            "pagamentos": "Payments",
                            "geral": "General",
                            "correcao": "Team correction"
                        },
                        "default": "geral"
                    },
                    "corpo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text",
                        "maxLength": 20000
                    },
                    "publico": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "For",
                        "enum": [
                            "interno",
                            "agente",
                            "paciente"
                        ],
                        "x-enum-rotulos": {
                            "interno": "Team only",
                            "agente": "Agent and assistants",
                            "paciente": "Patients"
                        },
                        "default": "agente"
                    },
                    "perfis": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "administracao",
                                "medico",
                                "enfermagem",
                                "tecnico",
                                "comercial",
                                "rececao"
                            ]
                        },
                        "title": "Roles",
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "clinico": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Clinical content",
                        "description": "Clinical content is approved only by the clinical director."
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "palavras": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Keywords",
                        "maxLength": 255
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "aprovado",
                            "arquivado"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "aprovado": "Approved",
                            "arquivado": "Archived"
                        },
                        "readOnly": true
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "aprovado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Approved by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Approved at",
                        "readOnly": true
                    },
                    "origem_correcao_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Correction of",
                        "x-anagen-recurso": "agente_pedidos",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.agente",
                "x-anagen-clinico": false
            },
            "Recurso_base_conhecimento_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 190
                    },
                    "categoria": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Category",
                        "enum": [
                            "horario",
                            "localizacao",
                            "consulta",
                            "procedimentos",
                            "pos_operatorio",
                            "pagamentos",
                            "geral",
                            "correcao"
                        ],
                        "x-enum-rotulos": {
                            "horario": "Opening hours",
                            "localizacao": "Location",
                            "consulta": "Consultation",
                            "procedimentos": "Procedures",
                            "pos_operatorio": "Post-operative",
                            "pagamentos": "Payments",
                            "geral": "General",
                            "correcao": "Team correction"
                        },
                        "default": "geral"
                    },
                    "corpo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text",
                        "maxLength": 20000
                    },
                    "publico": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "For",
                        "enum": [
                            "interno",
                            "agente",
                            "paciente"
                        ],
                        "x-enum-rotulos": {
                            "interno": "Team only",
                            "agente": "Agent and assistants",
                            "paciente": "Patients"
                        },
                        "default": "agente"
                    },
                    "perfis": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "administracao",
                                "medico",
                                "enfermagem",
                                "tecnico",
                                "comercial",
                                "rececao"
                            ]
                        },
                        "title": "Roles",
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "clinico": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Clinical content",
                        "description": "Clinical content is approved only by the clinical director."
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "palavras": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Keywords",
                        "maxLength": 255
                    }
                },
                "required": [
                    "titulo",
                    "categoria",
                    "corpo",
                    "publico"
                ]
            },
            "Recurso_caixas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date",
                        "readOnly": true
                    },
                    "local_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Location",
                        "x-anagen-recurso": "locais",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "aberta",
                            "fechada"
                        ],
                        "x-enum-rotulos": {
                            "aberta": "Open",
                            "fechada": "Closed"
                        },
                        "readOnly": true
                    },
                    "saldo_inicial": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Opening balance",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "total_numerario": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Cash",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "total_cartao": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Card",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "total_outros": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Other methods",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "contado": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Counted",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "diferenca": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Difference",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "aberta_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Opened by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "aberta_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Opened on",
                        "readOnly": true
                    },
                    "fechada_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Closed by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "fechada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Closed on",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-clinico": false
            },
            "Recurso_caixas_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_campanhas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "email",
                            "sms",
                            "whatsapp"
                        ],
                        "x-enum-rotulos": {
                            "email": "Email",
                            "sms": "SMS",
                            "whatsapp": "WhatsApp"
                        },
                        "default": "email"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "informacao",
                            "novidade",
                            "evento",
                            "avaliacao",
                            "reativacao",
                            "data_especial"
                        ],
                        "x-enum-rotulos": {
                            "informacao": "Information",
                            "novidade": "News",
                            "evento": "Event",
                            "avaliacao": "Review request",
                            "reativacao": "Reactivation",
                            "data_especial": "Special date"
                        },
                        "default": "informacao"
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purpose",
                        "description": "Marketing: only to people who consented (or existing customers). Service: no promotions.",
                        "enum": [
                            "marketing",
                            "servico"
                        ],
                        "x-enum-rotulos": {
                            "marketing": "Marketing communication",
                            "servico": "Service communication"
                        },
                        "default": "marketing"
                    },
                    "segmento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Segment",
                        "x-anagen-recurso": "segmentos"
                    },
                    "assunto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Subject",
                        "maxLength": 190
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "em_aprovacao",
                            "aprovada",
                            "agendada",
                            "a_enviar",
                            "enviada",
                            "cancelada"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "em_aprovacao": "Awaiting clinical approval",
                            "aprovada": "Approved",
                            "agendada": "Scheduled",
                            "a_enviar": "Sending",
                            "enviada": "Sent",
                            "cancelada": "Cancelled"
                        },
                        "readOnly": true
                    },
                    "agendada_para": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Scheduled for",
                        "readOnly": true
                    },
                    "enviada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Sent at",
                        "readOnly": true
                    },
                    "total": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Audience",
                        "readOnly": true
                    },
                    "entregues": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Delivered",
                        "readOnly": true
                    },
                    "cliques": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Clicks",
                        "readOnly": true
                    },
                    "anulacoes": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Unsubscribes",
                        "readOnly": true
                    },
                    "conversoes": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Conversions",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-clinico": false
            },
            "Recurso_campanhas_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "email",
                            "sms",
                            "whatsapp"
                        ],
                        "x-enum-rotulos": {
                            "email": "Email",
                            "sms": "SMS",
                            "whatsapp": "WhatsApp"
                        },
                        "default": "email"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "informacao",
                            "novidade",
                            "evento",
                            "avaliacao",
                            "reativacao",
                            "data_especial"
                        ],
                        "x-enum-rotulos": {
                            "informacao": "Information",
                            "novidade": "News",
                            "evento": "Event",
                            "avaliacao": "Review request",
                            "reativacao": "Reactivation",
                            "data_especial": "Special date"
                        },
                        "default": "informacao"
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purpose",
                        "description": "Marketing: only to people who consented (or existing customers). Service: no promotions.",
                        "enum": [
                            "marketing",
                            "servico"
                        ],
                        "x-enum-rotulos": {
                            "marketing": "Marketing communication",
                            "servico": "Service communication"
                        },
                        "default": "marketing"
                    },
                    "segmento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Segment",
                        "x-anagen-recurso": "segmentos"
                    },
                    "assunto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Subject",
                        "maxLength": 190
                    }
                },
                "required": [
                    "nome",
                    "canal",
                    "tipo",
                    "finalidade"
                ]
            },
            "Recurso_campanhas_chamadas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "reativacao",
                            "confirmacoes",
                            "lembretes",
                            "propostas_paradas",
                            "pos_operatorio",
                            "leads_fase"
                        ],
                        "x-enum-rotulos": {
                            "reativacao": "Reactivation",
                            "confirmacoes": "Confirmations",
                            "lembretes": "Reminders",
                            "propostas_paradas": "Stalled proposals",
                            "pos_operatorio": "Post-operative",
                            "leads_fase": "Leads in a stage"
                        },
                        "default": "reativacao"
                    },
                    "filtro": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Filter",
                        "description": "E.g. {\"dias\": 60} (reactivation and confirmations), {\"fase_id\": 5, \"origem\": \"site\"} (leads in a stage)."
                    },
                    "guiao_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Script",
                        "x-anagen-recurso": "guioes"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "ativa",
                            "pausada",
                            "concluida"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "ativa": "Active",
                            "pausada": "Paused",
                            "concluida": "Completed"
                        },
                        "readOnly": true,
                        "default": "rascunho"
                    },
                    "total": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Contacts",
                        "readOnly": true
                    },
                    "concluidos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Done",
                        "readOnly": true
                    },
                    "bloqueados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Blocked",
                        "description": "No consent for marketing calls or on the opt-out list.",
                        "readOnly": true
                    },
                    "gerada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Generated at",
                        "readOnly": true
                    },
                    "executor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Who calls",
                        "description": "The voice agent calls through the clinic phone system, with the same rules as the dialler.",
                        "enum": [
                            "pessoa",
                            "agente"
                        ],
                        "x-enum-rotulos": {
                            "pessoa": "A person (dialler)",
                            "agente": "Voice agent"
                        },
                        "default": "pessoa"
                    },
                    "janela_inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "The agent calls from",
                        "description": "Empty: the clinic opening hours."
                    },
                    "janela_fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "The agent calls until"
                    },
                    "numero_saida": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number shown to the person answering",
                        "description": "Empty: the clinic first number."
                    },
                    "lingua": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Call language",
                        "description": "Empty: each person's language.",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        }
                    },
                    "max_simultaneas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Simultaneous calls",
                        "maximum": 20,
                        "minimum": 1,
                        "default": 2
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-clinico": false
            },
            "Recurso_campanhas_chamadas_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "reativacao",
                            "confirmacoes",
                            "lembretes",
                            "propostas_paradas",
                            "pos_operatorio",
                            "leads_fase"
                        ],
                        "x-enum-rotulos": {
                            "reativacao": "Reactivation",
                            "confirmacoes": "Confirmations",
                            "lembretes": "Reminders",
                            "propostas_paradas": "Stalled proposals",
                            "pos_operatorio": "Post-operative",
                            "leads_fase": "Leads in a stage"
                        },
                        "default": "reativacao"
                    },
                    "filtro": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Filter",
                        "description": "E.g. {\"dias\": 60} (reactivation and confirmations), {\"fase_id\": 5, \"origem\": \"site\"} (leads in a stage)."
                    },
                    "guiao_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Script",
                        "x-anagen-recurso": "guioes"
                    },
                    "executor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Who calls",
                        "description": "The voice agent calls through the clinic phone system, with the same rules as the dialler.",
                        "enum": [
                            "pessoa",
                            "agente"
                        ],
                        "x-enum-rotulos": {
                            "pessoa": "A person (dialler)",
                            "agente": "Voice agent"
                        },
                        "default": "pessoa"
                    },
                    "janela_inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "The agent calls from",
                        "description": "Empty: the clinic opening hours."
                    },
                    "janela_fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "The agent calls until"
                    },
                    "numero_saida": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number shown to the person answering",
                        "description": "Empty: the clinic first number."
                    },
                    "lingua": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Call language",
                        "description": "Empty: each person's language.",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        }
                    },
                    "max_simultaneas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Simultaneous calls",
                        "maximum": 20,
                        "minimum": 1,
                        "default": 2
                    }
                },
                "required": [
                    "nome",
                    "tipo"
                ]
            },
            "Recurso_capturas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "avaliacao",
                            "pre_operatorio",
                            "cirurgia",
                            "seguimento"
                        ],
                        "x-enum-rotulos": {
                            "avaliacao": "Assessment",
                            "pre_operatorio": "Pre-operative",
                            "cirurgia": "Surgery (day 0)",
                            "seguimento": "Follow-up"
                        },
                        "default": "avaliacao"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Date"
                    },
                    "protocolo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Protocol",
                        "x-anagen-recurso": "protocolos_foto"
                    },
                    "marco_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Milestone",
                        "x-anagen-recurso": "marcos_acompanhamento"
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "minimum": 1
                    },
                    "qualidade_pontuacao": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Quality score",
                        "x-casas": 1,
                        "readOnly": true
                    },
                    "qualidade_ok": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Sufficient quality",
                        "readOnly": true
                    },
                    "cobertura_ok": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Sufficient coverage",
                        "readOnly": true
                    },
                    "escala_ok": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Scale confirmed",
                        "readOnly": true
                    },
                    "repetir": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Retake"
                    },
                    "repetir_motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason for retake",
                        "maxLength": 255
                    },
                    "realizada_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Taken by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "maxLength": 4000,
                        "x-anagen-cifrado": "clinico"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-clinico": true
            },
            "Recurso_capturas_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "avaliacao",
                            "pre_operatorio",
                            "cirurgia",
                            "seguimento"
                        ],
                        "x-enum-rotulos": {
                            "avaliacao": "Assessment",
                            "pre_operatorio": "Pre-operative",
                            "cirurgia": "Surgery (day 0)",
                            "seguimento": "Follow-up"
                        },
                        "default": "avaliacao"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Date"
                    },
                    "protocolo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Protocol",
                        "x-anagen-recurso": "protocolos_foto"
                    },
                    "marco_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Milestone",
                        "x-anagen-recurso": "marcos_acompanhamento"
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "minimum": 1
                    },
                    "repetir": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Retake"
                    },
                    "repetir_motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason for retake",
                        "maxLength": 255
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "maxLength": 4000,
                        "x-anagen-cifrado": "clinico"
                    }
                },
                "required": [
                    "paciente_id",
                    "tipo",
                    "data"
                ]
            },
            "Recurso_casos_publicados": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt",
                            "en"
                        ],
                        "x-enum-rotulos": "English",
                        "default": "pt"
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure (no.)",
                        "description": "Procedure number in the catalogue.",
                        "minimum": 1
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "maxLength": 300
                    },
                    "imagens": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Images",
                        "description": "List in the format [{\"id\": 12, \"legenda\": \"Before\"}, {\"id\": 13, \"legenda\": \"12 months\"}] with marketing library ids."
                    },
                    "texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text"
                    },
                    "publicado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Published",
                        "default": 0
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 9999,
                        "minimum": 0,
                        "default": 0
                    },
                    "consentimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Consent (no.)",
                        "description": "Filled in from the images.",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-clinico": false
            },
            "Recurso_casos_publicados_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt",
                            "en"
                        ],
                        "x-enum-rotulos": "English",
                        "default": "pt"
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure (no.)",
                        "description": "Procedure number in the catalogue.",
                        "minimum": 1
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "maxLength": 300
                    },
                    "imagens": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Images",
                        "description": "List in the format [{\"id\": 12, \"legenda\": \"Before\"}, {\"id\": 13, \"legenda\": \"12 months\"}] with marketing library ids."
                    },
                    "texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text"
                    },
                    "publicado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Published",
                        "default": 0
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 9999,
                        "minimum": 0,
                        "default": 0
                    }
                },
                "required": [
                    "titulo",
                    "idioma",
                    "imagens"
                ]
            },
            "Recurso_chamadas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "direcao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Direction",
                        "enum": [
                            "entrada",
                            "saida"
                        ],
                        "x-enum-rotulos": {
                            "entrada": "Incoming",
                            "saida": "Outgoing"
                        },
                        "default": "saida"
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "atendida",
                            "perdida",
                            "fora_horas",
                            "correio_voz",
                            "ocupado"
                        ],
                        "x-enum-rotulos": {
                            "atendida": "Answered",
                            "perdida": "Missed",
                            "fora_horas": "Out of hours",
                            "correio_voz": "Voicemail",
                            "ocupado": "Busy"
                        },
                        "default": "atendida"
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start"
                    },
                    "duracao_s": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Duration",
                        "minimum": 0,
                        "x-unidade": "s"
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Handled by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "x-anagen-recurso": "leads"
                    },
                    "resultado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Outcome",
                        "enum": [
                            "marcou_consulta",
                            "interessado",
                            "ligar_mais_tarde",
                            "sem_interesse",
                            "nao_atendeu",
                            "numero_errado",
                            "pediu_nao_contactar",
                            "confirmou",
                            "remarcou",
                            "cancelou",
                            "acompanhamento_feito"
                        ],
                        "x-enum-rotulos": {
                            "marcou_consulta": "Booked a consultation",
                            "interessado": "Interested",
                            "ligar_mais_tarde": "Call back later",
                            "sem_interesse": "Not interested",
                            "nao_atendeu": "No answer",
                            "numero_errado": "Wrong number",
                            "pediu_nao_contactar": "Asked not to be contacted",
                            "confirmou": "Confirmed",
                            "remarcou": "Rescheduled",
                            "cancelou": "Cancelled",
                            "acompanhamento_feito": "Follow-up done"
                        }
                    },
                    "devolvida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Returned at",
                        "readOnly": true
                    },
                    "pontuacao_guiao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Script score",
                        "readOnly": true
                    },
                    "gravacao_consentida": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Recording accepted",
                        "readOnly": true
                    },
                    "gravacao_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Recording",
                        "readOnly": true
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "x-anagen-cifrado": "geral",
                        "readOnly": true
                    },
                    "transcricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Transcript",
                        "x-anagen-permissao": "ficha.clinica",
                        "x-anagen-cifrado": "geral",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-clinico": false
            },
            "Recurso_chamadas_Entrada": {
                "type": "object",
                "properties": {
                    "direcao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Direction",
                        "enum": [
                            "entrada",
                            "saida"
                        ],
                        "x-enum-rotulos": {
                            "entrada": "Incoming",
                            "saida": "Outgoing"
                        },
                        "default": "saida"
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "atendida",
                            "perdida",
                            "fora_horas",
                            "correio_voz",
                            "ocupado"
                        ],
                        "x-enum-rotulos": {
                            "atendida": "Answered",
                            "perdida": "Missed",
                            "fora_horas": "Out of hours",
                            "correio_voz": "Voicemail",
                            "ocupado": "Busy"
                        },
                        "default": "atendida"
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start"
                    },
                    "duracao_s": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Duration",
                        "minimum": 0,
                        "x-unidade": "s"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "x-anagen-recurso": "leads"
                    },
                    "resultado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Outcome",
                        "enum": [
                            "marcou_consulta",
                            "interessado",
                            "ligar_mais_tarde",
                            "sem_interesse",
                            "nao_atendeu",
                            "numero_errado",
                            "pediu_nao_contactar",
                            "confirmou",
                            "remarcou",
                            "cancelou",
                            "acompanhamento_feito"
                        ],
                        "x-enum-rotulos": {
                            "marcou_consulta": "Booked a consultation",
                            "interessado": "Interested",
                            "ligar_mais_tarde": "Call back later",
                            "sem_interesse": "Not interested",
                            "nao_atendeu": "No answer",
                            "numero_errado": "Wrong number",
                            "pediu_nao_contactar": "Asked not to be contacted",
                            "confirmou": "Confirmed",
                            "remarcou": "Rescheduled",
                            "cancelou": "Cancelled",
                            "acompanhamento_feito": "Follow-up done"
                        }
                    }
                },
                "required": [
                    "direcao",
                    "numero",
                    "estado",
                    "inicio"
                ]
            },
            "Recurso_checklist_modelos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "fase": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phase",
                        "enum": [
                            "pre_operatorio",
                            "admissao",
                            "desenho",
                            "anestesia",
                            "extracao",
                            "implantacao",
                            "penso",
                            "alta"
                        ],
                        "x-enum-rotulos": {
                            "pre_operatorio": "Pre-operative",
                            "admissao": "Admission",
                            "desenho": "Design",
                            "anestesia": "Anaesthesia",
                            "extracao": "Extraction",
                            "implantacao": "Implantation",
                            "penso": "Dressing",
                            "alta": "Discharge"
                        }
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "maxLength": 40,
                        "pattern": "/^[a-z0-9_]{2,40}$/"
                    },
                    "itens_texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Items",
                        "description": "One item per line. Start with «(opcional)» for non-mandatory items and end with [enfermeiro], [cirurgiao], [tecnico]… to indicate who is responsible.",
                        "maxLength": 12000
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "bloco.registo",
                "x-anagen-clinico": false
            },
            "Recurso_checklist_modelos_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "fase": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phase",
                        "enum": [
                            "pre_operatorio",
                            "admissao",
                            "desenho",
                            "anestesia",
                            "extracao",
                            "implantacao",
                            "penso",
                            "alta"
                        ],
                        "x-enum-rotulos": {
                            "pre_operatorio": "Pre-operative",
                            "admissao": "Admission",
                            "desenho": "Design",
                            "anestesia": "Anaesthesia",
                            "extracao": "Extraction",
                            "implantacao": "Implantation",
                            "penso": "Dressing",
                            "alta": "Discharge"
                        }
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "maxLength": 40,
                        "pattern": "/^[a-z0-9_]{2,40}$/"
                    },
                    "itens_texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Items",
                        "description": "One item per line. Start with «(opcional)» for non-mandatory items and end with [enfermeiro], [cirurgiao], [tecnico]… to indicate who is responsible.",
                        "maxLength": 12000
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "fase",
                    "itens_texto"
                ]
            },
            "Recurso_cirurgias": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "inicio_previsto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Planned date",
                        "readOnly": true
                    },
                    "sala_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Room",
                        "x-anagen-recurso": "recursos_agenda",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pre_marcada",
                            "reservada",
                            "validada",
                            "confirmada",
                            "em_curso",
                            "concluida",
                            "cancelada"
                        ],
                        "x-enum-rotulos": {
                            "pre_marcada": "Pre-booked",
                            "reservada": "Reserved",
                            "validada": "Validated",
                            "confirmada": "Confirmed",
                            "em_curso": "In progress",
                            "concluida": "Completed",
                            "cancelada": "Cancelled"
                        },
                        "readOnly": true
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Technique",
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "FUE": "FUE",
                            "FUT": "FUT",
                            "DHI": "DHI",
                            "outra": "Other"
                        },
                        "readOnly": true
                    },
                    "aptidao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Fitness",
                        "enum": [
                            "por_avaliar",
                            "apto",
                            "nao_apto"
                        ],
                        "x-enum-rotulos": {
                            "por_avaliar": "Pending assessment",
                            "apto": "Fit",
                            "nao_apto": "Not fit"
                        },
                        "readOnly": true
                    },
                    "enxertos_planeados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Planned grafts",
                        "readOnly": true
                    },
                    "enxertos_extraidos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Extracted grafts",
                        "readOnly": true
                    },
                    "enxertos_implantados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Implanted grafts",
                        "readOnly": true
                    },
                    "cabelos_total": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Total hairs",
                        "readOnly": true
                    },
                    "transeccao_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Transection",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "fechada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Closed on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "bloco.mapa",
                "x-anagen-clinico": false
            },
            "Recurso_cirurgias_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_clinicas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinic code",
                        "description": "Public code that patients use in the app. It is changed in the clinic's licence.",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "nome_legal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Legal name",
                        "maxLength": 200
                    },
                    "nif": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{9}$",
                        "title": "NIF (Portuguese tax number)"
                    },
                    "ers_registo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "ERS registration no.",
                        "maxLength": 40
                    },
                    "licenca_numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Licence no.",
                        "maxLength": 60
                    },
                    "morada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Address",
                        "maxLength": 255
                    },
                    "codigo_postal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{4}-\\d{3}$",
                        "title": "Postcode"
                    },
                    "localidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Town",
                        "maxLength": 100
                    },
                    "pais": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Country",
                        "enum": [
                            "PT",
                            "ES",
                            "FR",
                            "BR",
                            "GB",
                            "DE"
                        ],
                        "x-enum-rotulos": {
                            "PT": "Portugal",
                            "ES": "España",
                            "FR": "France",
                            "BR": "Brasil",
                            "GB": "United Kingdom",
                            "DE": "Deutschland"
                        },
                        "default": "PT"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email",
                        "maxLength": 190
                    },
                    "website": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "title": "Website",
                        "maxLength": 190
                    },
                    "logotipo_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Logo"
                    },
                    "cor_marca": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Brand colour"
                    },
                    "fuso": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Time zone",
                        "enum": [
                            "Europe/Lisbon",
                            "Atlantic/Madeira",
                            "Atlantic/Azores",
                            "Europe/Madrid",
                            "Europe/Paris",
                            "Europe/London"
                        ],
                        "x-enum-rotulos": {
                            "Europe/Lisbon": "Lisboa",
                            "Atlantic/Madeira": "Madeira",
                            "Atlantic/Azores": "Açores",
                            "Europe/Madrid": "Madrid",
                            "Europe/Paris": "Paris",
                            "Europe/London": "Londres"
                        },
                        "default": "Europe/Lisbon"
                    },
                    "moeda": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Currency",
                        "enum": [
                            "EUR",
                            "GBP",
                            "BRL"
                        ],
                        "x-enum-rotulos": {
                            "EUR": "Euro (EUR)",
                            "GBP": "Libra (GBP)",
                            "BRL": "Real (BRL)"
                        },
                        "default": "EUR"
                    },
                    "modulos_ativos": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "admin.utilizadores",
                                "admin.definicoes",
                                "admin.auditoria",
                                "clinico.parametros",
                                "ficha.identificacao",
                                "ficha.consentimentos",
                                "ficha.clinica",
                                "ficha.captura",
                                "ficha.fotografias",
                                "ficha.plano",
                                "crm.leads",
                                "crm.atendimento",
                                "crm.telefonia",
                                "crm.agente",
                                "marketing",
                                "agenda",
                                "teleconsulta",
                                "bloco.mapa",
                                "bloco.marcar",
                                "bloco.registo",
                                "acompanhamento",
                                "comercial.propostas",
                                "comercial.descontos",
                                "financeiro.pagamentos",
                                "financeiro.valores",
                                "stock",
                                "documentos",
                                "conformidade",
                                "equipa.tarefas",
                                "equipa.chat",
                                "indicadores.financeiros",
                                "indicadores.vendas",
                                "indicadores.operacionais",
                                "indicadores.atendimento",
                                "site.cms"
                            ]
                        },
                        "title": "Active modules",
                        "description": "The essential modules (users, settings, audit log and tasks) are always active.",
                        "x-enum-rotulos": {
                            "admin.utilizadores": "Users and access",
                            "admin.definicoes": "Settings",
                            "admin.auditoria": "Audit log",
                            "clinico.parametros": "Clinical parameters",
                            "ficha.identificacao": "Patient identification",
                            "ficha.consentimentos": "Consents",
                            "ficha.clinica": "Clinical record",
                            "ficha.captura": "Capture and trichoscopy",
                            "ficha.fotografias": "Clinical photographs",
                            "ficha.plano": "Surgical plan",
                            "crm.leads": "Leads and funnel",
                            "crm.atendimento": "Customer service",
                            "crm.telefonia": "Telephony",
                            "crm.agente": "Conversation agent",
                            "marketing": "Marketing",
                            "agenda": "Schedule",
                            "teleconsulta": "Teleconsultation",
                            "bloco.mapa": "Surgery board",
                            "bloco.marcar": "Surgery booking",
                            "bloco.registo": "Surgical record",
                            "acompanhamento": "Follow-up",
                            "comercial.propostas": "Proposals",
                            "comercial.descontos": "Discounts",
                            "financeiro.pagamentos": "Payments",
                            "financeiro.valores": "Prices and commissions",
                            "stock": "Stock",
                            "documentos": "Documents",
                            "conformidade": "Compliance",
                            "equipa.tarefas": "Tasks",
                            "equipa.chat": "Team conversations",
                            "indicadores.financeiros": "Financial indicators",
                            "indicadores.vendas": "Sales indicators",
                            "indicadores.operacionais": "Operational indicators",
                            "indicadores.atendimento": "Customer service indicators",
                            "site.cms": "Website and content"
                        }
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-clinico": false
            },
            "Recurso_clinicas_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "nome_legal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Legal name",
                        "maxLength": 200
                    },
                    "nif": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{9}$",
                        "title": "NIF (Portuguese tax number)"
                    },
                    "ers_registo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "ERS registration no.",
                        "maxLength": 40
                    },
                    "licenca_numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Licence no.",
                        "maxLength": 60
                    },
                    "morada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Address",
                        "maxLength": 255
                    },
                    "codigo_postal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{4}-\\d{3}$",
                        "title": "Postcode"
                    },
                    "localidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Town",
                        "maxLength": 100
                    },
                    "pais": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Country",
                        "enum": [
                            "PT",
                            "ES",
                            "FR",
                            "BR",
                            "GB",
                            "DE"
                        ],
                        "x-enum-rotulos": {
                            "PT": "Portugal",
                            "ES": "España",
                            "FR": "France",
                            "BR": "Brasil",
                            "GB": "United Kingdom",
                            "DE": "Deutschland"
                        },
                        "default": "PT"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email",
                        "maxLength": 190
                    },
                    "website": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "title": "Website",
                        "maxLength": 190
                    },
                    "logotipo_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Logo"
                    },
                    "cor_marca": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Brand colour"
                    },
                    "fuso": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Time zone",
                        "enum": [
                            "Europe/Lisbon",
                            "Atlantic/Madeira",
                            "Atlantic/Azores",
                            "Europe/Madrid",
                            "Europe/Paris",
                            "Europe/London"
                        ],
                        "x-enum-rotulos": {
                            "Europe/Lisbon": "Lisboa",
                            "Atlantic/Madeira": "Madeira",
                            "Atlantic/Azores": "Açores",
                            "Europe/Madrid": "Madrid",
                            "Europe/Paris": "Paris",
                            "Europe/London": "Londres"
                        },
                        "default": "Europe/Lisbon"
                    },
                    "moeda": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Currency",
                        "enum": [
                            "EUR",
                            "GBP",
                            "BRL"
                        ],
                        "x-enum-rotulos": {
                            "EUR": "Euro (EUR)",
                            "GBP": "Libra (GBP)",
                            "BRL": "Real (BRL)"
                        },
                        "default": "EUR"
                    },
                    "modulos_ativos": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "admin.utilizadores",
                                "admin.definicoes",
                                "admin.auditoria",
                                "clinico.parametros",
                                "ficha.identificacao",
                                "ficha.consentimentos",
                                "ficha.clinica",
                                "ficha.captura",
                                "ficha.fotografias",
                                "ficha.plano",
                                "crm.leads",
                                "crm.atendimento",
                                "crm.telefonia",
                                "crm.agente",
                                "marketing",
                                "agenda",
                                "teleconsulta",
                                "bloco.mapa",
                                "bloco.marcar",
                                "bloco.registo",
                                "acompanhamento",
                                "comercial.propostas",
                                "comercial.descontos",
                                "financeiro.pagamentos",
                                "financeiro.valores",
                                "stock",
                                "documentos",
                                "conformidade",
                                "equipa.tarefas",
                                "equipa.chat",
                                "indicadores.financeiros",
                                "indicadores.vendas",
                                "indicadores.operacionais",
                                "indicadores.atendimento",
                                "site.cms"
                            ]
                        },
                        "title": "Active modules",
                        "description": "The essential modules (users, settings, audit log and tasks) are always active.",
                        "x-enum-rotulos": {
                            "admin.utilizadores": "Users and access",
                            "admin.definicoes": "Settings",
                            "admin.auditoria": "Audit log",
                            "clinico.parametros": "Clinical parameters",
                            "ficha.identificacao": "Patient identification",
                            "ficha.consentimentos": "Consents",
                            "ficha.clinica": "Clinical record",
                            "ficha.captura": "Capture and trichoscopy",
                            "ficha.fotografias": "Clinical photographs",
                            "ficha.plano": "Surgical plan",
                            "crm.leads": "Leads and funnel",
                            "crm.atendimento": "Customer service",
                            "crm.telefonia": "Telephony",
                            "crm.agente": "Conversation agent",
                            "marketing": "Marketing",
                            "agenda": "Schedule",
                            "teleconsulta": "Teleconsultation",
                            "bloco.mapa": "Surgery board",
                            "bloco.marcar": "Surgery booking",
                            "bloco.registo": "Surgical record",
                            "acompanhamento": "Follow-up",
                            "comercial.propostas": "Proposals",
                            "comercial.descontos": "Discounts",
                            "financeiro.pagamentos": "Payments",
                            "financeiro.valores": "Prices and commissions",
                            "stock": "Stock",
                            "documentos": "Documents",
                            "conformidade": "Compliance",
                            "equipa.tarefas": "Tasks",
                            "equipa.chat": "Team conversations",
                            "indicadores.financeiros": "Financial indicators",
                            "indicadores.vendas": "Sales indicators",
                            "indicadores.operacionais": "Operational indicators",
                            "indicadores.atendimento": "Customer service indicators",
                            "site.cms": "Website and content"
                        }
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome"
                ]
            },
            "Recurso_cms_blocos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "pagina": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Page",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "seccao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Section",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "rotulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Block",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt",
                            "en"
                        ],
                        "x-enum-rotulos": "English",
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "texto",
                            "textoLongo",
                            "html",
                            "imagem",
                            "lista",
                            "ligacao"
                        ],
                        "x-enum-rotulos": {
                            "texto": "Text",
                            "textoLongo": "Long text",
                            "html": "Formatted text",
                            "imagem": "Image",
                            "lista": "List",
                            "ligacao": "Link"
                        },
                        "readOnly": true
                    },
                    "valor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Value",
                        "description": "For lists and links the value is structured; the CMS editor edits it field by field.",
                        "maxLength": 300000
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Image (library no.)",
                        "description": "Number of the image in the library.",
                        "minimum": 1
                    },
                    "ajuda": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Help",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-clinico": false
            },
            "Recurso_cms_blocos_Entrada": {
                "type": "object",
                "properties": {
                    "valor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Value",
                        "description": "For lists and links the value is structured; the CMS editor edits it field by field.",
                        "maxLength": 300000
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Image (library no.)",
                        "description": "Number of the image in the library.",
                        "minimum": 1
                    }
                }
            },
            "Recurso_cms_paginas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "description": "Internal identifier (same in both languages).",
                        "maxLength": 80,
                        "pattern": "/^[a-z][a-z0-9_]{1,79}$/"
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt",
                            "en"
                        ],
                        "x-enum-rotulos": "English",
                        "default": "pt"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "institucional",
                            "procedimento",
                            "legal",
                            "caso"
                        ],
                        "x-enum-rotulos": {
                            "institucional": "Institutional",
                            "procedimento": "Procedure",
                            "legal": "Legal",
                            "caso": "Case"
                        },
                        "default": "institucional"
                    },
                    "slug": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Address",
                        "description": "Last part of the address, e.g. fue.",
                        "maxLength": 160,
                        "pattern": "/^[a-z0-9]+(?:-[a-z0-9]+)*$/"
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "maxLength": 500
                    },
                    "conteudo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Content",
                        "description": "Use the markers {clinica.nome_legal}, {clinica.nif}, {clinica.morada}… for the clinic's legal details."
                    },
                    "meta_titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Search title",
                        "description": "Up to 60 characters.",
                        "maxLength": 200
                    },
                    "meta_descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Search description",
                        "description": "Up to 160 characters.",
                        "maxLength": 320
                    },
                    "imagem_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Image (library no.)",
                        "description": "Number of the image in the website image library.",
                        "minimum": 1
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 9999,
                        "minimum": 0,
                        "default": 0
                    },
                    "publicada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Published",
                        "readOnly": true
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "publicada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Published on",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "site.cms",
                "x-anagen-clinico": false
            },
            "Recurso_cms_paginas_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "description": "Internal identifier (same in both languages).",
                        "maxLength": 80,
                        "pattern": "/^[a-z][a-z0-9_]{1,79}$/"
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt",
                            "en"
                        ],
                        "x-enum-rotulos": "English",
                        "default": "pt"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "institucional",
                            "procedimento",
                            "legal",
                            "caso"
                        ],
                        "x-enum-rotulos": {
                            "institucional": "Institutional",
                            "procedimento": "Procedure",
                            "legal": "Legal",
                            "caso": "Case"
                        },
                        "default": "institucional"
                    },
                    "slug": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Address",
                        "description": "Last part of the address, e.g. fue.",
                        "maxLength": 160,
                        "pattern": "/^[a-z0-9]+(?:-[a-z0-9]+)*$/"
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "maxLength": 500
                    },
                    "conteudo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Content",
                        "description": "Use the markers {clinica.nome_legal}, {clinica.nif}, {clinica.morada}… for the clinic's legal details."
                    },
                    "meta_titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Search title",
                        "description": "Up to 60 characters.",
                        "maxLength": 200
                    },
                    "meta_descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Search description",
                        "description": "Up to 160 characters.",
                        "maxLength": 320
                    },
                    "imagem_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Image (library no.)",
                        "description": "Number of the image in the website image library.",
                        "minimum": 1
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 9999,
                        "minimum": 0,
                        "default": 0
                    }
                },
                "required": [
                    "titulo",
                    "chave",
                    "idioma",
                    "tipo",
                    "slug"
                ]
            },
            "Recurso_codigos_desconto": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Code",
                        "description": "Letters, digits, “-” and “_”. Stored in capitals.",
                        "maxLength": 40
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 190
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "percentagem",
                            "fixo"
                        ],
                        "x-enum-rotulos": {
                            "percentagem": "Percentage",
                            "fixo": "Fixed amount"
                        },
                        "default": "percentagem"
                    },
                    "percentagem": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Percentage",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Fixed amount",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "minimo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Minimum proposal amount",
                        "description": "Subtotal before the discount.",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "procedimentos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Procedures covered",
                        "description": "Empty = all.",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "valido_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valido_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "limite_usos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Usage limit",
                        "description": "Counts proposals with the code that were not declined or expired.",
                        "maximum": 1000000,
                        "minimum": 1
                    },
                    "limite_por_paciente": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Limit per patient",
                        "maximum": 100,
                        "minimum": 1
                    },
                    "aprovacao_acima_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Approval above (%)",
                        "description": "Above this effective percentage, the discount waits for whoever approves discounts. Empty = approved by the code.",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "comercial.descontos",
                "x-anagen-clinico": false
            },
            "Recurso_codigos_desconto_Entrada": {
                "type": "object",
                "properties": {
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Code",
                        "description": "Letters, digits, “-” and “_”. Stored in capitals.",
                        "maxLength": 40
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 190
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "percentagem",
                            "fixo"
                        ],
                        "x-enum-rotulos": {
                            "percentagem": "Percentage",
                            "fixo": "Fixed amount"
                        },
                        "default": "percentagem"
                    },
                    "percentagem": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Percentage",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Fixed amount",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "minimo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Minimum proposal amount",
                        "description": "Subtotal before the discount.",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "procedimentos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Procedures covered",
                        "description": "Empty = all.",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "valido_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valido_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "limite_usos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Usage limit",
                        "description": "Counts proposals with the code that were not declined or expired.",
                        "maximum": 1000000,
                        "minimum": 1
                    },
                    "limite_por_paciente": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Limit per patient",
                        "maximum": 100,
                        "minimum": 1
                    },
                    "aprovacao_acima_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Approval above (%)",
                        "description": "Above this effective percentage, the discount waits for whoever approves discounts. Empty = approved by the code.",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    }
                },
                "required": [
                    "codigo",
                    "tipo"
                ]
            },
            "Recurso_comissoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "proposta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Proposal",
                        "x-anagen-recurso": "propostas"
                    },
                    "regra_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Rule",
                        "x-anagen-recurso": "comissoes_regras",
                        "readOnly": true
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Surgery",
                        "readOnly": true
                    },
                    "base_valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Base",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "taxa": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Rate",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Amount",
                        "maximum": 100000,
                        "minimum": -100000,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "prevista",
                            "devida",
                            "paga",
                            "estornada"
                        ],
                        "x-enum-rotulos": {
                            "prevista": "Expected",
                            "devida": "Due",
                            "paga": "Paid",
                            "estornada": "Reversed"
                        },
                        "default": "devida"
                    },
                    "vence_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Due on"
                    },
                    "paga_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Paid on",
                        "readOnly": true
                    },
                    "referencia_pagamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Payment reference",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "motivo_estorno": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reversal reason",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 500
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-clinico": false
            },
            "Recurso_comissoes_Entrada": {
                "type": "object",
                "properties": {
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "proposta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Proposal",
                        "x-anagen-recurso": "propostas"
                    },
                    "base_valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Base",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Amount",
                        "maximum": 100000,
                        "minimum": -100000,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "prevista",
                            "devida",
                            "paga",
                            "estornada"
                        ],
                        "x-enum-rotulos": {
                            "prevista": "Expected",
                            "devida": "Due",
                            "paga": "Paid",
                            "estornada": "Reversed"
                        },
                        "default": "devida"
                    },
                    "vence_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Due on"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 500
                    }
                },
                "required": [
                    "utilizador_id",
                    "valor"
                ]
            },
            "Recurso_comissoes_regras": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "description": "Leave blank to apply to the profile.",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "perfil_chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Profile",
                        "description": "Applies to everyone in this profile who has no rule of their own.",
                        "maxLength": 40,
                        "pattern": "^[a-z0-9_]{2,40}$",
                        "default": "comercial"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "percentagem",
                            "fixo"
                        ],
                        "x-enum-rotulos": {
                            "percentagem": "Percentage",
                            "fixo": "Fixed amount"
                        },
                        "default": "percentagem"
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Value",
                        "description": "Percentage or fixed amount per proposal.",
                        "maximum": 100000,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "escaloes": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Tiers",
                        "description": "Percentages by value band (optional)."
                    },
                    "base": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Calculation basis",
                        "enum": [
                            "bruto",
                            "sem_iva",
                            "liquido_descontos",
                            "liquido_consumiveis"
                        ],
                        "x-enum-rotulos": {
                            "bruto": "Total amount",
                            "sem_iva": "Amount excluding VAT",
                            "liquido_descontos": "Amount after discounts",
                            "liquido_consumiveis": "Amount after discounts and consumables"
                        },
                        "default": "liquido_descontos"
                    },
                    "vencimento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "When due",
                        "enum": [
                            "aceite",
                            "recebido",
                            "cirurgia"
                        ],
                        "x-enum-rotulos": {
                            "aceite": "On acceptance",
                            "recebido": "On full receipt",
                            "cirurgia": "On surgery"
                        },
                        "default": "recebido"
                    },
                    "procedimentos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Procedures",
                        "description": "Leave blank for all.",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "estorno_cancelamento": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Reverse if the proposal is cancelled or refunded",
                        "default": 1
                    },
                    "valida_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valida_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-clinico": false
            },
            "Recurso_comissoes_regras_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "description": "Leave blank to apply to the profile.",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "perfil_chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Profile",
                        "description": "Applies to everyone in this profile who has no rule of their own.",
                        "maxLength": 40,
                        "pattern": "^[a-z0-9_]{2,40}$",
                        "default": "comercial"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "percentagem",
                            "fixo"
                        ],
                        "x-enum-rotulos": {
                            "percentagem": "Percentage",
                            "fixo": "Fixed amount"
                        },
                        "default": "percentagem"
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Value",
                        "description": "Percentage or fixed amount per proposal.",
                        "maximum": 100000,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "escaloes": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Tiers",
                        "description": "Percentages by value band (optional)."
                    },
                    "base": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Calculation basis",
                        "enum": [
                            "bruto",
                            "sem_iva",
                            "liquido_descontos",
                            "liquido_consumiveis"
                        ],
                        "x-enum-rotulos": {
                            "bruto": "Total amount",
                            "sem_iva": "Amount excluding VAT",
                            "liquido_descontos": "Amount after discounts",
                            "liquido_consumiveis": "Amount after discounts and consumables"
                        },
                        "default": "liquido_descontos"
                    },
                    "vencimento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "When due",
                        "enum": [
                            "aceite",
                            "recebido",
                            "cirurgia"
                        ],
                        "x-enum-rotulos": {
                            "aceite": "On acceptance",
                            "recebido": "On full receipt",
                            "cirurgia": "On surgery"
                        },
                        "default": "recebido"
                    },
                    "procedimentos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Procedures",
                        "description": "Leave blank for all.",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "estorno_cancelamento": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Reverse if the proposal is cancelled or refunded",
                        "default": 1
                    },
                    "valida_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valida_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "tipo",
                    "valor",
                    "base",
                    "vencimento"
                ]
            },
            "Recurso_complicacoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "x-anagen-recurso": "episodios"
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Surgery",
                        "x-anagen-recurso": "cirurgias"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "foliculite",
                            "infecao",
                            "edema",
                            "hemorragia",
                            "dor_persistente",
                            "parestesia",
                            "efluvio",
                            "quisto",
                            "necrose",
                            "cicatriz",
                            "crescimento_insuficiente",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "foliculite": "Folliculitis",
                            "infecao": "Infection",
                            "edema": "Oedema",
                            "hemorragia": "Bleeding",
                            "dor_persistente": "Persistent pain",
                            "parestesia": "Paraesthesia / numbness",
                            "efluvio": "Shock loss",
                            "quisto": "Inclusion cyst",
                            "necrose": "Necrosis",
                            "cicatriz": "Abnormal scarring",
                            "crescimento_insuficiente": "Poor growth",
                            "outra": "Other"
                        }
                    },
                    "gravidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Severity",
                        "enum": [
                            "ligeira",
                            "moderada",
                            "grave"
                        ],
                        "x-enum-rotulos": {
                            "ligeira": "Mild",
                            "moderada": "Moderate",
                            "grave": "Severe"
                        },
                        "default": "ligeira"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 8000,
                        "x-anagen-cifrado": "clinico"
                    },
                    "tratamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Treatment",
                        "maxLength": 8000,
                        "x-anagen-cifrado": "clinico"
                    },
                    "recall": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Recall the patient",
                        "description": "On the date set, a recall task is opened for the nursing team."
                    },
                    "recall_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Recall date"
                    },
                    "resolvida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Resolved on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-clinico": true
            },
            "Recurso_complicacoes_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "x-anagen-recurso": "episodios"
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Surgery",
                        "x-anagen-recurso": "cirurgias"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "foliculite",
                            "infecao",
                            "edema",
                            "hemorragia",
                            "dor_persistente",
                            "parestesia",
                            "efluvio",
                            "quisto",
                            "necrose",
                            "cicatriz",
                            "crescimento_insuficiente",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "foliculite": "Folliculitis",
                            "infecao": "Infection",
                            "edema": "Oedema",
                            "hemorragia": "Bleeding",
                            "dor_persistente": "Persistent pain",
                            "parestesia": "Paraesthesia / numbness",
                            "efluvio": "Shock loss",
                            "quisto": "Inclusion cyst",
                            "necrose": "Necrosis",
                            "cicatriz": "Abnormal scarring",
                            "crescimento_insuficiente": "Poor growth",
                            "outra": "Other"
                        }
                    },
                    "gravidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Severity",
                        "enum": [
                            "ligeira",
                            "moderada",
                            "grave"
                        ],
                        "x-enum-rotulos": {
                            "ligeira": "Mild",
                            "moderada": "Moderate",
                            "grave": "Severe"
                        },
                        "default": "ligeira"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 8000,
                        "x-anagen-cifrado": "clinico"
                    },
                    "tratamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Treatment",
                        "maxLength": 8000,
                        "x-anagen-cifrado": "clinico"
                    },
                    "recall": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Recall the patient",
                        "description": "On the date set, a recall task is opened for the nursing team."
                    },
                    "recall_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Recall date"
                    }
                },
                "required": [
                    "paciente_id",
                    "tipo",
                    "gravidade",
                    "data",
                    "descricao"
                ]
            },
            "Recurso_comunicados": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "corpo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text"
                    },
                    "publico": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Audience",
                        "enum": [
                            "todos",
                            "departamento",
                            "perfil"
                        ],
                        "x-enum-rotulos": {
                            "todos": "Entire team",
                            "departamento": "Department",
                            "perfil": "Profile"
                        },
                        "default": "todos"
                    },
                    "destino": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department or profile",
                        "description": "Profile family (department) or the profile it is addressed to.",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "importancia": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Importance",
                        "enum": [
                            "normal",
                            "alta"
                        ],
                        "x-enum-rotulos": {
                            "normal": "Normal",
                            "alta": "Important"
                        },
                        "default": "normal"
                    },
                    "exige_leitura": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Request read confirmation",
                        "description": "Each person confirms “I have read and understood”; you can see who has yet to read it.",
                        "default": 1
                    },
                    "fixado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Pin to top",
                        "default": 0
                    },
                    "publicado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Publish on",
                        "description": "Leave blank to publish now. A future date schedules the publication."
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Stop showing on"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-clinico": false
            },
            "Recurso_comunicados_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "corpo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text"
                    },
                    "publico": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Audience",
                        "enum": [
                            "todos",
                            "departamento",
                            "perfil"
                        ],
                        "x-enum-rotulos": {
                            "todos": "Entire team",
                            "departamento": "Department",
                            "perfil": "Profile"
                        },
                        "default": "todos"
                    },
                    "destino": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department or profile",
                        "description": "Profile family (department) or the profile it is addressed to.",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "importancia": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Importance",
                        "enum": [
                            "normal",
                            "alta"
                        ],
                        "x-enum-rotulos": {
                            "normal": "Normal",
                            "alta": "Important"
                        },
                        "default": "normal"
                    },
                    "exige_leitura": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Request read confirmation",
                        "description": "Each person confirms “I have read and understood”; you can see who has yet to read it.",
                        "default": 1
                    },
                    "fixado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Pin to top",
                        "default": 0
                    },
                    "publicado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Publish on",
                        "description": "Leave blank to publish now. A future date schedules the publication."
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Stop showing on"
                    }
                },
                "required": [
                    "titulo",
                    "corpo"
                ]
            },
            "Recurso_consentimento_modelos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "description": "Stable template identifier (lowercase letters, digits and «_»). New versions keep the same key.",
                        "maxLength": 60,
                        "pattern": "^[a-z][a-z0-9_]{2,59}$"
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purpose",
                        "enum": [
                            "tratamento_clinico",
                            "fotografias_clinicas",
                            "imagens_comunicacao",
                            "captura_3d",
                            "gravacao_chamadas",
                            "gravacao_video",
                            "ia",
                            "agente_voz",
                            "marketing",
                            "partilha_terceiros",
                            "teleconsulta",
                            "cirurgico",
                            "contacto"
                        ],
                        "x-enum-rotulos": {
                            "tratamento_clinico": "Processing of data for healthcare",
                            "fotografias_clinicas": "Clinical photographs",
                            "imagens_comunicacao": "Images in communications and social media",
                            "captura_3d": "3D capture and models",
                            "gravacao_chamadas": "Call recording",
                            "gravacao_video": "Video recording",
                            "ia": "Artificial intelligence assistant",
                            "agente_voz": "Voice agent",
                            "marketing": "Marketing communications",
                            "partilha_terceiros": "Sharing with third parties",
                            "teleconsulta": "Teleconsultation",
                            "cirurgico": "Surgical consent",
                            "contacto": "Commercial contact"
                        }
                    },
                    "base_legal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Legal basis",
                        "description": "Legal basis for processing (GDPR, Arts. 6 and 9). For health data in care, «Provision of healthcare»; for images in communications or marketing, «Consent».",
                        "enum": [
                            "consentimento",
                            "prestacao_cuidados",
                            "contrato",
                            "interesse_legitimo",
                            "obrigacao_legal"
                        ],
                        "x-enum-rotulos": {
                            "consentimento": "Consent",
                            "prestacao_cuidados": "Provision of healthcare",
                            "contrato": "Performance of a contract",
                            "interesse_legitimo": "Legitimate interest",
                            "obrigacao_legal": "Legal obligation"
                        },
                        "default": "consentimento"
                    },
                    "obrigatorio": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Mandatory",
                        "description": "Flagged as missing in the patient record and on the dashboard until the patient decides."
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese (Portugal)",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Technique",
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "FUE": "FUE",
                            "FUT": "FUT",
                            "DHI": "DHI",
                            "outra": "Other technique"
                        }
                    },
                    "reflexao_horas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Reflection period (hours)",
                        "description": "Minimum time between handing over the information and signing. For surgical consents, at least the value set in Settings applies.",
                        "maximum": 720,
                        "minimum": 0
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "aprovado",
                            "arquivado"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "aprovado": "Approved",
                            "arquivado": "Archived"
                        },
                        "readOnly": true
                    },
                    "introducao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Introduction",
                        "description": "Short text shown before the sections (you can use fields such as {{paciente.nome}})."
                    },
                    "dgs_ato": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description of the procedure",
                        "maxLength": 20000
                    },
                    "dgs_objetivos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Objectives",
                        "maxLength": 20000
                    },
                    "dgs_beneficios": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Expected benefits",
                        "maxLength": 20000
                    },
                    "dgs_riscos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Frequent and serious risks",
                        "maxLength": 30000
                    },
                    "dgs_alternativas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Alternatives",
                        "maxLength": 20000
                    },
                    "dgs_cuidados": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Care before and after",
                        "maxLength": 20000
                    },
                    "dgs_declaracao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Patient declaration",
                        "maxLength": 20000
                    },
                    "texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Full text",
                        "description": "Text the patient reads and accepts. In surgical templates it is built from the sections of DGS Norma 015/2013.",
                        "readOnly": true
                    },
                    "revisao_juridica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Reviewed by the DPO/legal team",
                        "readOnly": true
                    },
                    "aprovado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Approved by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Approved on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-clinico": false
            },
            "Recurso_consentimento_modelos_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "description": "Stable template identifier (lowercase letters, digits and «_»). New versions keep the same key.",
                        "maxLength": 60,
                        "pattern": "^[a-z][a-z0-9_]{2,59}$"
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purpose",
                        "enum": [
                            "tratamento_clinico",
                            "fotografias_clinicas",
                            "imagens_comunicacao",
                            "captura_3d",
                            "gravacao_chamadas",
                            "gravacao_video",
                            "ia",
                            "agente_voz",
                            "marketing",
                            "partilha_terceiros",
                            "teleconsulta",
                            "cirurgico",
                            "contacto"
                        ],
                        "x-enum-rotulos": {
                            "tratamento_clinico": "Processing of data for healthcare",
                            "fotografias_clinicas": "Clinical photographs",
                            "imagens_comunicacao": "Images in communications and social media",
                            "captura_3d": "3D capture and models",
                            "gravacao_chamadas": "Call recording",
                            "gravacao_video": "Video recording",
                            "ia": "Artificial intelligence assistant",
                            "agente_voz": "Voice agent",
                            "marketing": "Marketing communications",
                            "partilha_terceiros": "Sharing with third parties",
                            "teleconsulta": "Teleconsultation",
                            "cirurgico": "Surgical consent",
                            "contacto": "Commercial contact"
                        }
                    },
                    "base_legal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Legal basis",
                        "description": "Legal basis for processing (GDPR, Arts. 6 and 9). For health data in care, «Provision of healthcare»; for images in communications or marketing, «Consent».",
                        "enum": [
                            "consentimento",
                            "prestacao_cuidados",
                            "contrato",
                            "interesse_legitimo",
                            "obrigacao_legal"
                        ],
                        "x-enum-rotulos": {
                            "consentimento": "Consent",
                            "prestacao_cuidados": "Provision of healthcare",
                            "contrato": "Performance of a contract",
                            "interesse_legitimo": "Legitimate interest",
                            "obrigacao_legal": "Legal obligation"
                        },
                        "default": "consentimento"
                    },
                    "obrigatorio": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Mandatory",
                        "description": "Flagged as missing in the patient record and on the dashboard until the patient decides."
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese (Portugal)",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Technique",
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "FUE": "FUE",
                            "FUT": "FUT",
                            "DHI": "DHI",
                            "outra": "Other technique"
                        }
                    },
                    "reflexao_horas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Reflection period (hours)",
                        "description": "Minimum time between handing over the information and signing. For surgical consents, at least the value set in Settings applies.",
                        "maximum": 720,
                        "minimum": 0
                    },
                    "introducao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Introduction",
                        "description": "Short text shown before the sections (you can use fields such as {{paciente.nome}})."
                    },
                    "dgs_ato": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description of the procedure",
                        "maxLength": 20000
                    },
                    "dgs_objetivos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Objectives",
                        "maxLength": 20000
                    },
                    "dgs_beneficios": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Expected benefits",
                        "maxLength": 20000
                    },
                    "dgs_riscos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Frequent and serious risks",
                        "maxLength": 30000
                    },
                    "dgs_alternativas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Alternatives",
                        "maxLength": 20000
                    },
                    "dgs_cuidados": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Care before and after",
                        "maxLength": 20000
                    },
                    "dgs_declaracao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Patient declaration",
                        "maxLength": 20000
                    }
                },
                "required": [
                    "titulo",
                    "chave",
                    "finalidade",
                    "base_legal",
                    "idioma"
                ]
            },
            "Recurso_consentimentos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Contact",
                        "x-anagen-recurso": "leads",
                        "readOnly": true
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purpose",
                        "enum": [
                            "tratamento_clinico",
                            "fotografias_clinicas",
                            "imagens_comunicacao",
                            "captura_3d",
                            "gravacao_chamadas",
                            "gravacao_video",
                            "ia",
                            "agente_voz",
                            "marketing",
                            "partilha_terceiros",
                            "teleconsulta",
                            "cirurgico",
                            "contacto"
                        ],
                        "x-enum-rotulos": {
                            "tratamento_clinico": "Processing of data for healthcare",
                            "fotografias_clinicas": "Clinical photographs",
                            "imagens_comunicacao": "Images in communications and social media",
                            "captura_3d": "3D capture and models",
                            "gravacao_chamadas": "Call recording",
                            "gravacao_video": "Video recording",
                            "ia": "Artificial intelligence assistant",
                            "agente_voz": "Voice agent",
                            "marketing": "Marketing communications",
                            "partilha_terceiros": "Sharing with third parties",
                            "teleconsulta": "Teleconsultation",
                            "cirurgico": "Surgical consent",
                            "contacto": "Commercial contact"
                        },
                        "readOnly": true
                    },
                    "decisao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Decision",
                        "enum": [
                            "dado",
                            "recusado",
                            "revogado"
                        ],
                        "x-enum-rotulos": {
                            "dado": "Given",
                            "recusado": "Refused",
                            "revogado": "Withdrawn"
                        },
                        "readOnly": true
                    },
                    "modelo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Template",
                        "x-anagen-recurso": "consentimento_modelos",
                        "readOnly": true
                    },
                    "modelo_versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "portal",
                            "presencial",
                            "formulario_site",
                            "telefone",
                            "email",
                            "whatsapp",
                            "agente_voz",
                            "app"
                        ],
                        "x-enum-rotulos": {
                            "portal": "Patient portal",
                            "presencial": "In person",
                            "formulario_site": "Website form",
                            "telefone": "Phone",
                            "email": "Email",
                            "whatsapp": "WhatsApp",
                            "agente_voz": "Voice agent",
                            "app": "Mobile app"
                        },
                        "readOnly": true
                    },
                    "informacao_entregue_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Information handed over on",
                        "readOnly": true
                    },
                    "assinado_paciente_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Signed by the patient on",
                        "readOnly": true
                    },
                    "medico_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Doctor",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "assinado_medico_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Signed by the doctor on",
                        "readOnly": true
                    },
                    "assinatura_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Signature",
                        "readOnly": true
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "readOnly": true
                    },
                    "plano_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Plan",
                        "readOnly": true
                    },
                    "recolhido_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Collected by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "dispositivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Device",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "ip": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "IP address",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "texto_hash": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text fingerprint",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "impressao_digital": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Record fingerprint",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.consentimentos",
                "x-anagen-clinico": false
            },
            "Recurso_consentimentos_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_conservacao_regras": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "categoria": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Category",
                        "enum": [
                            "processo_clinico",
                            "leads_nao_convertidos",
                            "gravacoes_chamadas",
                            "imagens_bruto",
                            "auditoria",
                            "pedidos_titulares",
                            "alertas_acesso",
                            "documentos_anulados",
                            "reclamacoes",
                            "faturacao"
                        ],
                        "x-enum-rotulos": {
                            "processo_clinico": "Clinical record",
                            "leads_nao_convertidos": "Unconverted contacts",
                            "gravacoes_chamadas": "Call recordings",
                            "imagens_bruto": "Raw images",
                            "auditoria": "Audit log",
                            "pedidos_titulares": "Data subject requests",
                            "alertas_acesso": "Access alerts",
                            "documentos_anulados": "Voided documents",
                            "reclamacoes": "Complaints",
                            "faturacao": "Invoicing"
                        }
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 500
                    },
                    "prazo": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Deadline",
                        "maximum": 1200,
                        "minimum": 1
                    },
                    "unidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Unit",
                        "enum": [
                            "dias",
                            "meses",
                            "anos"
                        ],
                        "x-enum-rotulos": {
                            "dias": "days",
                            "meses": "months",
                            "anos": "years"
                        },
                        "default": "anos"
                    },
                    "anos": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Equivalent in years",
                        "x-unidade": "anos",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "acao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "At the end of the period",
                        "enum": [
                            "anonimizar",
                            "eliminar",
                            "rever"
                        ],
                        "x-enum-rotulos": {
                            "anonimizar": "Anonymise",
                            "eliminar": "Delete",
                            "rever": "Review"
                        }
                    },
                    "base_legal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Legal basis",
                        "maxLength": 255
                    },
                    "automatica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Automatic",
                        "description": "When switched off, the system only creates a review task with the number of records past the retention period.",
                        "default": 1
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "ultima_execucao_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last run",
                        "readOnly": true
                    },
                    "ultimo_resultado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Last result",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_conservacao_regras_Entrada": {
                "type": "object",
                "properties": {
                    "categoria": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Category",
                        "enum": [
                            "processo_clinico",
                            "leads_nao_convertidos",
                            "gravacoes_chamadas",
                            "imagens_bruto",
                            "auditoria",
                            "pedidos_titulares",
                            "alertas_acesso",
                            "documentos_anulados",
                            "reclamacoes",
                            "faturacao"
                        ],
                        "x-enum-rotulos": {
                            "processo_clinico": "Clinical record",
                            "leads_nao_convertidos": "Unconverted contacts",
                            "gravacoes_chamadas": "Call recordings",
                            "imagens_bruto": "Raw images",
                            "auditoria": "Audit log",
                            "pedidos_titulares": "Data subject requests",
                            "alertas_acesso": "Access alerts",
                            "documentos_anulados": "Voided documents",
                            "reclamacoes": "Complaints",
                            "faturacao": "Invoicing"
                        }
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 500
                    },
                    "prazo": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Deadline",
                        "maximum": 1200,
                        "minimum": 1
                    },
                    "unidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Unit",
                        "enum": [
                            "dias",
                            "meses",
                            "anos"
                        ],
                        "x-enum-rotulos": {
                            "dias": "days",
                            "meses": "months",
                            "anos": "years"
                        },
                        "default": "anos"
                    },
                    "acao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "At the end of the period",
                        "enum": [
                            "anonimizar",
                            "eliminar",
                            "rever"
                        ],
                        "x-enum-rotulos": {
                            "anonimizar": "Anonymise",
                            "eliminar": "Delete",
                            "rever": "Review"
                        }
                    },
                    "base_legal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Legal basis",
                        "maxLength": 255
                    },
                    "automatica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Automatic",
                        "description": "When switched off, the system only creates a review task with the number of records past the retention period.",
                        "default": 1
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "categoria",
                    "prazo",
                    "unidade",
                    "acao"
                ]
            },
            "Recurso_consultas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "x-anagen-recurso": "episodios",
                        "readOnly": true
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Date",
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Consultation type",
                        "enum": [
                            "primeira",
                            "avaliacao",
                            "controlo",
                            "teleconsulta",
                            "pre_operatoria"
                        ],
                        "x-enum-rotulos": {
                            "primeira": "First consultation",
                            "avaliacao": "Assessment",
                            "controlo": "Follow-up",
                            "teleconsulta": "Teleconsultation",
                            "pre_operatoria": "Pre-operative"
                        },
                        "readOnly": true
                    },
                    "medico_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Physician",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "assinada"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "assinada": "Signed"
                        },
                        "readOnly": true
                    },
                    "elegibilidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Eligibility",
                        "enum": [
                            "por_avaliar",
                            "apto",
                            "apto_condicional",
                            "nao_apto"
                        ],
                        "x-enum-rotulos": {
                            "por_avaliar": "Not yet assessed",
                            "apto": "Eligible",
                            "apto_condicional": "Eligible with conditions",
                            "nao_apto": "Not eligible"
                        },
                        "readOnly": true
                    },
                    "escala": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Scale",
                        "enum": [
                            "norwood",
                            "ludwig",
                            "savin",
                            "sinclair",
                            "basp",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "norwood": "Norwood-Hamilton",
                            "ludwig": "Ludwig",
                            "savin": "Savin",
                            "sinclair": "Sinclair",
                            "basp": "BASP",
                            "outra": "Other"
                        },
                        "readOnly": true
                    },
                    "grau": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Grade",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "basp": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "BASP classification",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "precise_pontuacao": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "PRECISE score",
                        "x-casas": 1,
                        "readOnly": true
                    },
                    "miniaturizacao_dadora_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Donor area miniaturisation",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 1,
                        "readOnly": true
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Technique",
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "FUE": "FUE",
                            "FUT": "FUT",
                            "DHI": "DHI",
                            "outra": "Other"
                        },
                        "readOnly": true
                    },
                    "viabilidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Feasibility",
                        "enum": [
                            "viavel",
                            "condicional",
                            "nao_viavel"
                        ],
                        "x-enum-rotulos": {
                            "viavel": "Feasible",
                            "condicional": "Feasible with conditions",
                            "nao_viavel": "Not feasible"
                        },
                        "readOnly": true
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason for consultation",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "antecedentes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Past medical history",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "medicacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Current medication",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "alergias": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Allergies",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "habitos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Lifestyle",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "historia_familiar": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Family history",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "expectativas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Expectations",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "exame": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Physical examination",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "diagnostico": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Diagnosis",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "diagnostico_diferencial": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Differential diagnosis",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "assinada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Signed on",
                        "readOnly": true
                    },
                    "impressao_digital": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Record fingerprint",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-clinico": true
            },
            "Recurso_consultas_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_contas_pagadoras": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 190
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "empresa",
                            "familiar",
                            "seguradora",
                            "subsistema",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "empresa": "Company",
                            "familiar": "Family member",
                            "seguradora": "Insurer",
                            "subsistema": "Health subsystem",
                            "outro": "Other"
                        },
                        "default": "empresa"
                    },
                    "nif": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{9}$",
                        "title": "Tax number",
                        "x-anagen-cifrado": "geral"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email",
                        "maxLength": 190
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone"
                    },
                    "morada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Address",
                        "maxLength": 255
                    },
                    "codigo_postal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{4}-\\d{3}$",
                        "title": "Postcode"
                    },
                    "localidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Town",
                        "maxLength": 100
                    },
                    "pais": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Country",
                        "maxLength": 60,
                        "default": "Portugal"
                    },
                    "faturar_ao_pagador": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Invoice the payer",
                        "description": "The tax document for the payer’s share is issued in this account’s name.",
                        "default": 1
                    },
                    "entidade_publica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Public entity",
                        "description": "Requires a CIUS-PT e-invoice; the document keeps the delivery pending until recorded.",
                        "default": 0
                    },
                    "prazo_pagamento_dias": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Payment term (days)",
                        "maximum": 365,
                        "minimum": 0,
                        "default": 30
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-clinico": false
            },
            "Recurso_contas_pagadoras_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 190
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "empresa",
                            "familiar",
                            "seguradora",
                            "subsistema",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "empresa": "Company",
                            "familiar": "Family member",
                            "seguradora": "Insurer",
                            "subsistema": "Health subsystem",
                            "outro": "Other"
                        },
                        "default": "empresa"
                    },
                    "nif": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{9}$",
                        "title": "Tax number",
                        "x-anagen-cifrado": "geral"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email",
                        "maxLength": 190
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone"
                    },
                    "morada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Address",
                        "maxLength": 255
                    },
                    "codigo_postal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{4}-\\d{3}$",
                        "title": "Postcode"
                    },
                    "localidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Town",
                        "maxLength": 100
                    },
                    "pais": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Country",
                        "maxLength": 60,
                        "default": "Portugal"
                    },
                    "faturar_ao_pagador": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Invoice the payer",
                        "description": "The tax document for the payer’s share is issued in this account’s name.",
                        "default": 1
                    },
                    "entidade_publica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Public entity",
                        "description": "Requires a CIUS-PT e-invoice; the document keeps the delivery pending until recorded.",
                        "default": 0
                    },
                    "prazo_pagamento_dias": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Payment term (days)",
                        "maximum": 365,
                        "minimum": 0,
                        "default": 30
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    }
                },
                "required": [
                    "nome",
                    "tipo"
                ]
            },
            "Recurso_contas_subcontas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "conta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Paying account",
                        "x-anagen-recurso": "contas_pagadoras"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "relacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Relationship",
                        "enum": [
                            "titular",
                            "colaborador",
                            "conjuge",
                            "filho",
                            "beneficiario",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "titular": "Account holder",
                            "colaborador": "Employee",
                            "conjuge": "Spouse",
                            "filho": "Child",
                            "beneficiario": "Beneficiary",
                            "outro": "Other"
                        },
                        "default": "beneficiario"
                    },
                    "numero_beneficiario": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Beneficiary no.",
                        "description": "Stored encrypted. Shown on invoices issued to the account.",
                        "maxLength": 60,
                        "x-anagen-cifrado": "geral"
                    },
                    "cobertura_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Payer coverage (%)",
                        "description": "Share of each procedure paid by the account; the rest is for the patient.",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2,
                        "default": 100
                    },
                    "limite": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Annual limit",
                        "description": "Empty = no limit. Above the limit, the amount goes to the patient.",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "valida_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valida_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-clinico": false
            },
            "Recurso_contas_subcontas_Entrada": {
                "type": "object",
                "properties": {
                    "conta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Paying account",
                        "x-anagen-recurso": "contas_pagadoras"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "relacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Relationship",
                        "enum": [
                            "titular",
                            "colaborador",
                            "conjuge",
                            "filho",
                            "beneficiario",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "titular": "Account holder",
                            "colaborador": "Employee",
                            "conjuge": "Spouse",
                            "filho": "Child",
                            "beneficiario": "Beneficiary",
                            "outro": "Other"
                        },
                        "default": "beneficiario"
                    },
                    "numero_beneficiario": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Beneficiary no.",
                        "description": "Stored encrypted. Shown on invoices issued to the account.",
                        "maxLength": 60,
                        "x-anagen-cifrado": "geral"
                    },
                    "cobertura_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Payer coverage (%)",
                        "description": "Share of each procedure paid by the account; the rest is for the patient.",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2,
                        "default": 100
                    },
                    "limite": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Annual limit",
                        "description": "Empty = no limit. Above the limit, the amount goes to the patient.",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "valida_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valida_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    }
                },
                "required": [
                    "conta_id",
                    "paciente_id"
                ]
            },
            "Recurso_convencoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "seguro",
                            "subsistema",
                            "convencao",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "seguro": "Health insurance",
                            "subsistema": "Subsystem",
                            "convencao": "Agreement",
                            "outro": "Other agreement"
                        },
                        "default": "seguro"
                    },
                    "conta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Entity (paying account)",
                        "description": "Receives the invoice for its share. Beneficiaries are this account’s sub-accounts.",
                        "x-anagen-recurso": "contas_pagadoras"
                    },
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Agreement code",
                        "maxLength": 40
                    },
                    "exige_autorizacao": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires prior authorisation",
                        "description": "Asks for the entity’s authorisation number for each procedure.",
                        "default": 0
                    },
                    "valida_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valida_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-clinico": false
            },
            "Recurso_convencoes_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "seguro",
                            "subsistema",
                            "convencao",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "seguro": "Health insurance",
                            "subsistema": "Subsystem",
                            "convencao": "Agreement",
                            "outro": "Other agreement"
                        },
                        "default": "seguro"
                    },
                    "conta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Entity (paying account)",
                        "description": "Receives the invoice for its share. Beneficiaries are this account’s sub-accounts.",
                        "x-anagen-recurso": "contas_pagadoras"
                    },
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Agreement code",
                        "maxLength": 40
                    },
                    "exige_autorizacao": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires prior authorisation",
                        "description": "Asks for the entity’s authorisation number for each procedure.",
                        "default": 0
                    },
                    "valida_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valida_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    }
                },
                "required": [
                    "nome",
                    "tipo",
                    "conta_id"
                ]
            },
            "Recurso_convencoes_atos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "convencao_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Agreement",
                        "x-anagen-recurso": "convencoes"
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "codigo_ato": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Procedure code at the entity",
                        "maxLength": 40
                    },
                    "preco": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Agreed price",
                        "description": "Empty = the amount entered at the time.",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "comparticipacao_tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Co-payment",
                        "enum": [
                            "percentagem",
                            "fixo"
                        ],
                        "x-enum-rotulos": {
                            "percentagem": "Percentage",
                            "fixo": "Fixed amount"
                        },
                        "default": "percentagem"
                    },
                    "comparticipacao_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Entity percentage",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "comparticipacao_valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Entity amount",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "limite_anual": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Limit per beneficiary and year",
                        "description": "Number of co-paid procedures per year. Empty = no limit.",
                        "maximum": 999,
                        "minimum": 1
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 500
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-clinico": false
            },
            "Recurso_convencoes_atos_Entrada": {
                "type": "object",
                "properties": {
                    "convencao_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Agreement",
                        "x-anagen-recurso": "convencoes"
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "codigo_ato": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Procedure code at the entity",
                        "maxLength": 40
                    },
                    "preco": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Agreed price",
                        "description": "Empty = the amount entered at the time.",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "comparticipacao_tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Co-payment",
                        "enum": [
                            "percentagem",
                            "fixo"
                        ],
                        "x-enum-rotulos": {
                            "percentagem": "Percentage",
                            "fixo": "Fixed amount"
                        },
                        "default": "percentagem"
                    },
                    "comparticipacao_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Entity percentage",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "comparticipacao_valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Entity amount",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "limite_anual": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Limit per beneficiary and year",
                        "description": "Number of co-paid procedures per year. Empty = no limit.",
                        "maximum": 999,
                        "minimum": 1
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 500
                    }
                },
                "required": [
                    "convencao_id",
                    "procedimento_id",
                    "comparticipacao_tipo"
                ]
            },
            "Recurso_conversas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "portal",
                            "whatsapp",
                            "instagram",
                            "messenger",
                            "email",
                            "chat_site",
                            "sms"
                        ],
                        "x-enum-rotulos": {
                            "portal": "Portal",
                            "whatsapp": "WhatsApp",
                            "instagram": "Instagram",
                            "messenger": "Messenger",
                            "email": "Email",
                            "chat_site": "Website chat",
                            "sms": "SMS"
                        },
                        "readOnly": true
                    },
                    "contacto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Contact",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "assunto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Subject",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "x-anagen-recurso": "leads",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "aberta",
                            "pendente",
                            "resolvida"
                        ],
                        "x-enum-rotulos": {
                            "aberta": "Open",
                            "pendente": "Awaiting reply",
                            "resolvida": "Resolved"
                        }
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Doctor",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Front desk"
                        }
                    },
                    "atribuida_a": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Assigned to",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "ia_a_tratar": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "AI handling",
                        "readOnly": true
                    },
                    "sla_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Reply by",
                        "readOnly": true
                    },
                    "primeira_resposta_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "First reply",
                        "readOnly": true
                    },
                    "ultima_mensagem_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last message",
                        "readOnly": true
                    },
                    "avaliacao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Rating (1–5)",
                        "readOnly": true
                    },
                    "avaliacao_comentario": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Supervisor comment",
                        "maxLength": 2000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-clinico": false
            },
            "Recurso_conversas_Entrada": {
                "type": "object",
                "properties": {
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "aberta",
                            "pendente",
                            "resolvida"
                        ],
                        "x-enum-rotulos": {
                            "aberta": "Open",
                            "pendente": "Awaiting reply",
                            "resolvida": "Resolved"
                        }
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Doctor",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Front desk"
                        }
                    },
                    "atribuida_a": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Assigned to",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "avaliacao_comentario": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Supervisor comment",
                        "maxLength": 2000
                    }
                }
            },
            "Recurso_cuidados_conteudos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 190
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "video",
                            "artigo"
                        ],
                        "x-enum-rotulos": {
                            "video": "Video",
                            "artigo": "Article"
                        },
                        "default": "video"
                    },
                    "dia": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Available on day",
                        "description": "Days after surgery (0 = surgery day; 1, 3, 7, 10, 30…).",
                        "maximum": 730,
                        "minimum": 0,
                        "default": 0
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "maxLength": 500
                    },
                    "video_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Video",
                        "description": "The clinic’s own video (no external players)."
                    },
                    "duracao_segundos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Duration",
                        "maximum": 7200,
                        "minimum": 1,
                        "x-unidade": "s"
                    },
                    "corpo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text",
                        "description": "Clear instructions, no individual prescriptions."
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "description": "Empty = all procedures.",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "todos",
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "todos": "All languages",
                            "pt-PT": "Português (Portugal)",
                            "pt-BR": "Português (Brasil)",
                            "en": "English",
                            "es": "Español",
                            "fr": "Français",
                            "de": "Deutsch"
                        },
                        "default": "todos"
                    },
                    "notificar": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Notify the patient",
                        "description": "Sends a notice when the content becomes available.",
                        "default": 1
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "por_aprovar",
                            "aprovado",
                            "retirado"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "por_aprovar": "Awaiting approval",
                            "aprovado": "Approved",
                            "retirado": "Withdrawn"
                        },
                        "readOnly": true
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "aprovado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Approved by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Approved on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-clinico": false
            },
            "Recurso_cuidados_conteudos_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 190
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "video",
                            "artigo"
                        ],
                        "x-enum-rotulos": {
                            "video": "Video",
                            "artigo": "Article"
                        },
                        "default": "video"
                    },
                    "dia": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Available on day",
                        "description": "Days after surgery (0 = surgery day; 1, 3, 7, 10, 30…).",
                        "maximum": 730,
                        "minimum": 0,
                        "default": 0
                    },
                    "resumo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Summary",
                        "maxLength": 500
                    },
                    "video_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Video",
                        "description": "The clinic’s own video (no external players)."
                    },
                    "duracao_segundos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Duration",
                        "maximum": 7200,
                        "minimum": 1,
                        "x-unidade": "s"
                    },
                    "corpo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text",
                        "description": "Clear instructions, no individual prescriptions."
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "description": "Empty = all procedures.",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "todos",
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "todos": "All languages",
                            "pt-PT": "Português (Portugal)",
                            "pt-BR": "Português (Brasil)",
                            "en": "English",
                            "es": "Español",
                            "fr": "Français",
                            "de": "Deutsch"
                        },
                        "default": "todos"
                    },
                    "notificar": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Notify the patient",
                        "description": "Sends a notice when the content becomes available.",
                        "default": 1
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    }
                },
                "required": [
                    "titulo",
                    "dia"
                ]
            },
            "Recurso_custos_anuncios": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "plataforma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Platform",
                        "enum": [
                            "meta",
                            "google",
                            "tiktok",
                            "linkedin",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "meta": "Meta",
                            "google": "Google",
                            "tiktok": "TikTok",
                            "linkedin": "LinkedIn",
                            "outra": "Other"
                        }
                    },
                    "campanha": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Campaign",
                        "description": "Same as the leads’ “utm_campaign” or campaign, to match results.",
                        "maxLength": 120
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date"
                    },
                    "custo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Cost",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "impressoes": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Impressions",
                        "minimum": 0
                    },
                    "cliques": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Clicks",
                        "minimum": 0
                    },
                    "leads": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Leads on the platform",
                        "description": "As reported by the platform; real leads are counted in AnagenSys.",
                        "minimum": 0
                    },
                    "importacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Import",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-clinico": false
            },
            "Recurso_custos_anuncios_Entrada": {
                "type": "object",
                "properties": {
                    "plataforma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Platform",
                        "enum": [
                            "meta",
                            "google",
                            "tiktok",
                            "linkedin",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "meta": "Meta",
                            "google": "Google",
                            "tiktok": "TikTok",
                            "linkedin": "LinkedIn",
                            "outra": "Other"
                        }
                    },
                    "campanha": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Campaign",
                        "description": "Same as the leads’ “utm_campaign” or campaign, to match results.",
                        "maxLength": 120
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date"
                    },
                    "custo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Cost",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "impressoes": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Impressions",
                        "minimum": 0
                    },
                    "cliques": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Clicks",
                        "minimum": 0
                    },
                    "leads": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Leads on the platform",
                        "description": "As reported by the platform; real leads are counted in AnagenSys.",
                        "minimum": 0
                    }
                },
                "required": [
                    "plataforma",
                    "campanha",
                    "data",
                    "custo"
                ]
            },
            "Recurso_datas_especiais": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Date",
                        "description": "The surgery anniversary uses clinical data: it only goes to people with explicit marketing consent.",
                        "enum": [
                            "aniversario",
                            "aniversario_cirurgia"
                        ],
                        "x-enum-rotulos": {
                            "aniversario": "Birthday",
                            "aniversario_cirurgia": "Surgery anniversary"
                        },
                        "default": "aniversario"
                    },
                    "campanha_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Campaign",
                        "description": "A «Special date» campaign approved by the clinical director.",
                        "x-anagen-recurso": "campanhas"
                    },
                    "publico": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "For",
                        "enum": [
                            "pacientes",
                            "leads",
                            "todos"
                        ],
                        "x-enum-rotulos": {
                            "pacientes": "Patients",
                            "leads": "Leads",
                            "todos": "Patients and leads"
                        },
                        "default": "pacientes"
                    },
                    "dias_antes": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Days in advance",
                        "description": "0 = on the day.",
                        "maximum": 30,
                        "minimum": 0,
                        "default": 0
                    },
                    "hora": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "Send time",
                        "default": "10:00"
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "description": "Only with an approved campaign.",
                        "default": 0
                    },
                    "enviados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Sent",
                        "readOnly": true
                    },
                    "bloqueados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Not sent",
                        "readOnly": true
                    },
                    "ultimo_processamento_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Last run",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-clinico": false
            },
            "Recurso_datas_especiais_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Date",
                        "description": "The surgery anniversary uses clinical data: it only goes to people with explicit marketing consent.",
                        "enum": [
                            "aniversario",
                            "aniversario_cirurgia"
                        ],
                        "x-enum-rotulos": {
                            "aniversario": "Birthday",
                            "aniversario_cirurgia": "Surgery anniversary"
                        },
                        "default": "aniversario"
                    },
                    "campanha_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Campaign",
                        "description": "A «Special date» campaign approved by the clinical director.",
                        "x-anagen-recurso": "campanhas"
                    },
                    "publico": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "For",
                        "enum": [
                            "pacientes",
                            "leads",
                            "todos"
                        ],
                        "x-enum-rotulos": {
                            "pacientes": "Patients",
                            "leads": "Leads",
                            "todos": "Patients and leads"
                        },
                        "default": "pacientes"
                    },
                    "dias_antes": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Days in advance",
                        "description": "0 = on the day.",
                        "maximum": 30,
                        "minimum": 0,
                        "default": 0
                    },
                    "hora": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "Send time",
                        "default": "10:00"
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "description": "Only with an approved campaign.",
                        "default": 0
                    }
                },
                "required": [
                    "nome",
                    "tipo",
                    "campanha_id"
                ]
            },
            "Recurso_delegacoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "de_utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Delegated by",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "para_utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Delegated to",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "End",
                        "description": "At most 90 days after the start."
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason",
                        "maxLength": 255
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-clinico": false
            },
            "Recurso_delegacoes_Entrada": {
                "type": "object",
                "properties": {
                    "de_utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Delegated by",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "para_utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Delegated to",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "End",
                        "description": "At most 90 days after the start."
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason",
                        "maxLength": 255
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "de_utilizador_id",
                    "para_utilizador_id",
                    "inicio",
                    "fim"
                ]
            },
            "Recurso_diagnosticos_apoio": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Diagnosis",
                        "maxLength": 160
                    },
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Code",
                        "description": "Optional ICD-10 or SNOMED CT code. It is included in the European-format summary.",
                        "maxLength": 30
                    },
                    "sistema": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Terminology",
                        "enum": [
                            "icd10",
                            "snomed",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "icd10": "ICD-10",
                            "snomed": "SNOMED CT",
                            "outro": "Other"
                        }
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Guidance",
                        "description": "Criteria or signs that help to consider this diagnosis (shown in the consultation).",
                        "maxLength": 600
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 10000,
                        "minimum": 0,
                        "default": 100
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "aprovada",
                            "arquivada"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "aprovada": "Approved",
                            "arquivada": "Archived"
                        },
                        "readOnly": true
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "readOnly": true
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "aprovado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Approved by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Approved on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-clinico": false
            },
            "Recurso_diagnosticos_apoio_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Diagnosis",
                        "maxLength": 160
                    },
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Code",
                        "description": "Optional ICD-10 or SNOMED CT code. It is included in the European-format summary.",
                        "maxLength": 30
                    },
                    "sistema": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Terminology",
                        "enum": [
                            "icd10",
                            "snomed",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "icd10": "ICD-10",
                            "snomed": "SNOMED CT",
                            "outro": "Other"
                        }
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Guidance",
                        "description": "Criteria or signs that help to consider this diagnosis (shown in the consultation).",
                        "maxLength": 600
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 10000,
                        "minimum": 0,
                        "default": 100
                    }
                },
                "required": [
                    "nome"
                ]
            },
            "Recurso_documento_modelos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 200
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "description": "Stable template identifier (lowercase letters, digits and «_»). New versions keep the same key.",
                        "maxLength": 60,
                        "pattern": "^[a-z][a-z0-9_]{2,59}$"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "proposta",
                            "consentimento",
                            "instrucoes",
                            "declaracao",
                            "relatorio",
                            "alta",
                            "carta"
                        ],
                        "x-enum-rotulos": {
                            "proposta": "Proposal",
                            "consentimento": "Consent",
                            "instrucoes": "Instructions",
                            "declaracao": "Declaration",
                            "relatorio": "Report",
                            "alta": "Discharge",
                            "carta": "Letter"
                        }
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 500
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese (Portugal)",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "clinico": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Clinical content",
                        "description": "Only people with clinical access to the patient can see the content; approval by the clinical management."
                    },
                    "assinatura": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires the data subject’s signature",
                        "description": "The document can be signed on screen, with a code sent to the data subject or with a qualified signature."
                    },
                    "assinatura_medico": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires the doctor’s signature"
                    },
                    "partilhar_padrao": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Share on the portal by default",
                        "default": 1
                    },
                    "conteudo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Content",
                        "description": "Use fields in double curly braces, for example {{paciente.nome}}, {{entidade.nome_legal}} or {{campos.observacoes}}. The full list is on the issuing screen.",
                        "maxLength": 400000
                    },
                    "campos_extra": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Additional fields",
                        "description": "Fields requested when issuing: a list of objects with «chave» (key), «rotulo» (label), «tipo» (type: texto, textoLongo, data, numero) and «obrigatorio» (mandatory)."
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "aprovado",
                            "arquivado"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "aprovado": "Approved",
                            "arquivado": "Archived"
                        },
                        "readOnly": true
                    },
                    "revisao_juridica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Reviewed by the DPO/legal team",
                        "description": "Tick once the data protection officer or the legal team has reviewed the text. Texts supplied with the system arrive unreviewed."
                    },
                    "aprovado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Approved by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Approved on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-clinico": false
            },
            "Recurso_documento_modelos_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 200
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "description": "Stable template identifier (lowercase letters, digits and «_»). New versions keep the same key.",
                        "maxLength": 60,
                        "pattern": "^[a-z][a-z0-9_]{2,59}$"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "proposta",
                            "consentimento",
                            "instrucoes",
                            "declaracao",
                            "relatorio",
                            "alta",
                            "carta"
                        ],
                        "x-enum-rotulos": {
                            "proposta": "Proposal",
                            "consentimento": "Consent",
                            "instrucoes": "Instructions",
                            "declaracao": "Declaration",
                            "relatorio": "Report",
                            "alta": "Discharge",
                            "carta": "Letter"
                        }
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 500
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese (Portugal)",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "clinico": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Clinical content",
                        "description": "Only people with clinical access to the patient can see the content; approval by the clinical management."
                    },
                    "assinatura": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires the data subject’s signature",
                        "description": "The document can be signed on screen, with a code sent to the data subject or with a qualified signature."
                    },
                    "assinatura_medico": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires the doctor’s signature"
                    },
                    "partilhar_padrao": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Share on the portal by default",
                        "default": 1
                    },
                    "conteudo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Content",
                        "description": "Use fields in double curly braces, for example {{paciente.nome}}, {{entidade.nome_legal}} or {{campos.observacoes}}. The full list is on the issuing screen.",
                        "maxLength": 400000
                    },
                    "campos_extra": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Additional fields",
                        "description": "Fields requested when issuing: a list of objects with «chave» (key), «rotulo» (label), «tipo» (type: texto, textoLongo, data, numero) and «obrigatorio» (mandatory)."
                    },
                    "revisao_juridica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Reviewed by the DPO/legal team",
                        "description": "Tick once the data protection officer or the legal team has reviewed the text. Texts supplied with the system arrive unreviewed."
                    }
                },
                "required": [
                    "nome",
                    "chave",
                    "tipo",
                    "idioma",
                    "conteudo"
                ]
            },
            "Recurso_documentos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "proposta",
                            "consentimento",
                            "instrucoes",
                            "declaracao",
                            "relatorio",
                            "alta",
                            "carta"
                        ],
                        "x-enum-rotulos": {
                            "proposta": "Proposal",
                            "consentimento": "Consent",
                            "instrucoes": "Instructions",
                            "declaracao": "Declaration",
                            "relatorio": "Report",
                            "alta": "Discharge",
                            "carta": "Letter"
                        },
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "readOnly": true
                    },
                    "modelo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Template",
                        "x-anagen-recurso": "documento_modelos",
                        "readOnly": true
                    },
                    "modelo_versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "emitido",
                            "enviado",
                            "assinado",
                            "anulado"
                        ],
                        "x-enum-rotulos": {
                            "emitido": "Issued",
                            "enviado": "Sent for signature",
                            "assinado": "Signed",
                            "anulado": "Void"
                        },
                        "readOnly": true
                    },
                    "assinatura_tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Signature",
                        "enum": [
                            "ecra",
                            "codigo",
                            "qualificada"
                        ],
                        "x-enum-rotulos": {
                            "ecra": "On screen (in person)",
                            "codigo": "With a code sent",
                            "qualificada": "Qualified"
                        },
                        "readOnly": true
                    },
                    "codigo_verificacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Verification code",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "conteudo_hash": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Fingerprint",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "partilhado_paciente": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Document shared on the portal.",
                        "readOnly": true
                    },
                    "enviado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Sent on",
                        "readOnly": true
                    },
                    "assinado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Signed on",
                        "readOnly": true
                    },
                    "anulado_motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason for voiding",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "documentos",
                "x-anagen-clinico": false
            },
            "Recurso_documentos_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_documentos_fiscais": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "FT",
                            "FR",
                            "RG",
                            "NC",
                            "FS"
                        ],
                        "x-enum-rotulos": {
                            "FT": "Invoice",
                            "FR": "Invoice-receipt",
                            "RG": "Receipt",
                            "NC": "Credit note",
                            "FS": "Simplified invoice"
                        },
                        "readOnly": true
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pedido",
                            "emitido",
                            "anulado",
                            "erro"
                        ],
                        "x-enum-rotulos": {
                            "pedido": "Being issued",
                            "emitido": "Issued",
                            "anulado": "Voided",
                            "erro": "Error"
                        },
                        "readOnly": true
                    },
                    "cliente_nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Customer name",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "cliente_nif_mascarado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "NIF (tax number)",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "descricao_servico": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Service description",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "base": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Taxable amount",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "iva": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "VAT",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "total": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Total",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "iva_taxa": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "VAT rate (%)",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "iva_motivo_isencao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Exemption reason",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "atcud": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "ATCUD",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "serie": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Series",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Software",
                        "enum": [
                            "invoicexpress",
                            "manual"
                        ],
                        "x-enum-rotulos": {
                            "invoicexpress": "InvoiceXpress",
                            "manual": "Manual record (other certified software)"
                        },
                        "readOnly": true
                    },
                    "emitido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Issued on",
                        "readOnly": true
                    },
                    "pdf_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "PDF",
                        "readOnly": true
                    },
                    "pagamento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Payment",
                        "x-anagen-recurso": "pagamentos",
                        "readOnly": true
                    },
                    "documento_origem_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Source document",
                        "x-anagen-recurso": "documentos_fiscais",
                        "readOnly": true
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "erro": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Error",
                        "maxLength": 255,
                        "x-anagen-permissao": "financeiro.pagamentos",
                        "readOnly": true
                    },
                    "enviado_paciente_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Sent to the patient on",
                        "readOnly": true
                    },
                    "conta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Paying account",
                        "x-anagen-recurso": "contas_pagadoras",
                        "readOnly": true
                    },
                    "eletronica_formato": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "E-invoice format",
                        "enum": [
                            "cius_pt",
                            "pdf_assinado"
                        ],
                        "x-enum-rotulos": {
                            "cius_pt": "CIUS-PT",
                            "pdf_assinado": "PDF with qualified signature"
                        },
                        "readOnly": true
                    },
                    "eletronica_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "E-invoice",
                        "enum": [
                            "exigida",
                            "registada",
                            "nao_suportada"
                        ],
                        "x-enum-rotulos": {
                            "exigida": "To be delivered",
                            "registada": "Delivered",
                            "nao_suportada": "Not supported"
                        },
                        "readOnly": true
                    },
                    "eletronica_referencia": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Delivery reference",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "eletronica_ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "PDF with qualified signature",
                        "readOnly": true
                    },
                    "eletronica_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Recorded on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-clinico": false
            },
            "Recurso_documentos_fiscais_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_encomendas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Supplier",
                        "maxLength": 160
                    },
                    "fornecedor_email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Supplier email"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "enviada",
                            "recebida",
                            "cancelada"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "enviada": "Sent",
                            "recebida": "Received",
                            "cancelada": "Cancelled"
                        },
                        "readOnly": true
                    },
                    "linhas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Lines",
                        "description": "Item, quantity and unit price for each line."
                    },
                    "total": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Total",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "prevista_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Expected delivery"
                    },
                    "enviada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Sent on",
                        "readOnly": true
                    },
                    "recebida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Received on",
                        "readOnly": true
                    },
                    "recebida_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Received by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-clinico": false
            },
            "Recurso_encomendas_Entrada": {
                "type": "object",
                "properties": {
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Supplier",
                        "maxLength": 160
                    },
                    "fornecedor_email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Supplier email"
                    },
                    "linhas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Lines",
                        "description": "Item, quantity and unit price for each line."
                    },
                    "prevista_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Expected delivery"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    }
                },
                "required": [
                    "fornecedor",
                    "linhas"
                ]
            },
            "Recurso_episodios": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Episode no.",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "description": "Defaults to the name of the chosen procedure.",
                        "maxLength": 160
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Technique",
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "FUE": "FUE",
                            "FUT": "FUT",
                            "DHI": "DHI",
                            "outra": "Other"
                        }
                    },
                    "area": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Area",
                        "enum": [
                            "couro_cabeludo",
                            "barba",
                            "sobrancelhas",
                            "feminina",
                            "reparacao",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "couro_cabeludo": "Scalp",
                            "barba": "Beard",
                            "sobrancelhas": "Eyebrows",
                            "feminina": "Female hair loss",
                            "reparacao": "Repair of previous surgery",
                            "outra": "Other"
                        }
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "avaliacao",
                            "plano",
                            "proposta",
                            "agendado",
                            "pre_operatorio",
                            "cirurgia",
                            "pos_operatorio",
                            "acompanhamento",
                            "concluido",
                            "cancelado"
                        ],
                        "x-enum-rotulos": {
                            "avaliacao": "Assessment",
                            "plano": "Plan",
                            "proposta": "Proposal",
                            "agendado": "Scheduled",
                            "pre_operatorio": "Pre-operative",
                            "cirurgia": "Surgery",
                            "pos_operatorio": "Post-operative",
                            "acompanhamento": "Follow-up",
                            "concluido": "Completed",
                            "cancelado": "Cancelled"
                        },
                        "readOnly": true
                    },
                    "etapa_jornada": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Journey stage",
                        "maximum": 9,
                        "minimum": 1,
                        "readOnly": true
                    },
                    "medico_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead physician",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "aberto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Opened on",
                        "readOnly": true
                    },
                    "fechado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Closed on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-clinico": false
            },
            "Recurso_episodios_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "description": "Defaults to the name of the chosen procedure.",
                        "maxLength": 160
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Technique",
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "FUE": "FUE",
                            "FUT": "FUT",
                            "DHI": "DHI",
                            "outra": "Other"
                        }
                    },
                    "area": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Area",
                        "enum": [
                            "couro_cabeludo",
                            "barba",
                            "sobrancelhas",
                            "feminina",
                            "reparacao",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "couro_cabeludo": "Scalp",
                            "barba": "Beard",
                            "sobrancelhas": "Eyebrows",
                            "feminina": "Female hair loss",
                            "reparacao": "Repair of previous surgery",
                            "outra": "Other"
                        }
                    },
                    "medico_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead physician",
                        "x-anagen-recurso": "utilizadores"
                    }
                },
                "required": [
                    "paciente_id"
                ]
            },
            "Recurso_episodios_equipa": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "x-anagen-recurso": "episodios"
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Professional",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "papel": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Role",
                        "enum": [
                            "medico",
                            "cirurgiao",
                            "enfermeiro",
                            "tecnico",
                            "assistente",
                            "anestesista",
                            "coordenador",
                            "comercial",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "medico": "Physician",
                            "cirurgiao": "Surgeon",
                            "enfermeiro": "Nurse",
                            "tecnico": "Technician",
                            "assistente": "Assistant",
                            "anestesista": "Anaesthetist",
                            "coordenador": "Coordinator",
                            "comercial": "Patient advisor",
                            "outro": "Other"
                        }
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "End",
                        "description": "Empty while the membership is active. When it ends, access to the clinical record is revoked."
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-clinico": false
            },
            "Recurso_episodios_equipa_Entrada": {
                "type": "object",
                "properties": {
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "x-anagen-recurso": "episodios"
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Professional",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "papel": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Role",
                        "enum": [
                            "medico",
                            "cirurgiao",
                            "enfermeiro",
                            "tecnico",
                            "assistente",
                            "anestesista",
                            "coordenador",
                            "comercial",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "medico": "Physician",
                            "cirurgiao": "Surgeon",
                            "enfermeiro": "Nurse",
                            "tecnico": "Technician",
                            "assistente": "Assistant",
                            "anestesista": "Anaesthetist",
                            "coordenador": "Coordinator",
                            "comercial": "Patient advisor",
                            "outro": "Other"
                        }
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "End",
                        "description": "Empty while the membership is active. When it ends, access to the clinical record is revoked."
                    }
                },
                "required": [
                    "episodio_id",
                    "utilizador_id",
                    "papel"
                ]
            },
            "Recurso_equipamentos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "marca": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Brand",
                        "maxLength": 100
                    },
                    "modelo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Model",
                        "maxLength": 100
                    },
                    "numero_serie": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Serial number",
                        "maxLength": 100
                    },
                    "dispositivo_medico": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Medical device",
                        "default": 1
                    },
                    "marcacao_ce": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "CE marking",
                        "description": "Notified body number, where applicable.",
                        "maxLength": 60
                    },
                    "classe": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Class",
                        "enum": [
                            "I",
                            "Is",
                            "Im",
                            "IIa",
                            "IIb",
                            "III",
                            "nao_dm"
                        ],
                        "x-enum-rotulos": {
                            "I": "Class I",
                            "Is": "Class Is (sterile)",
                            "Im": "Class Im (measuring)",
                            "IIa": "Class IIa",
                            "IIb": "Class IIb",
                            "III": "Class III",
                            "nao_dm": "Not a medical device"
                        }
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Supplier",
                        "maxLength": 160
                    },
                    "localizacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Location",
                        "maxLength": 100
                    },
                    "aquisicao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Acquisition"
                    },
                    "garantia_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Warranty until"
                    },
                    "periodicidade_meses": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Maintenance interval (months)",
                        "description": "The next maintenance is calculated from the last record.",
                        "maximum": 120,
                        "minimum": 1
                    },
                    "proxima_manutencao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Next maintenance"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "ativo",
                            "manutencao",
                            "inativo",
                            "abatido"
                        ],
                        "x-enum-rotulos": {
                            "ativo": "Active",
                            "manutencao": "Under maintenance",
                            "inativo": "Inactive",
                            "abatido": "Decommissioned"
                        },
                        "default": "ativo"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 5000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_equipamentos_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "marca": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Brand",
                        "maxLength": 100
                    },
                    "modelo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Model",
                        "maxLength": 100
                    },
                    "numero_serie": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Serial number",
                        "maxLength": 100
                    },
                    "dispositivo_medico": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Medical device",
                        "default": 1
                    },
                    "marcacao_ce": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "CE marking",
                        "description": "Notified body number, where applicable.",
                        "maxLength": 60
                    },
                    "classe": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Class",
                        "enum": [
                            "I",
                            "Is",
                            "Im",
                            "IIa",
                            "IIb",
                            "III",
                            "nao_dm"
                        ],
                        "x-enum-rotulos": {
                            "I": "Class I",
                            "Is": "Class Is (sterile)",
                            "Im": "Class Im (measuring)",
                            "IIa": "Class IIa",
                            "IIb": "Class IIb",
                            "III": "Class III",
                            "nao_dm": "Not a medical device"
                        }
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Supplier",
                        "maxLength": 160
                    },
                    "localizacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Location",
                        "maxLength": 100
                    },
                    "aquisicao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Acquisition"
                    },
                    "garantia_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Warranty until"
                    },
                    "periodicidade_meses": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Maintenance interval (months)",
                        "description": "The next maintenance is calculated from the last record.",
                        "maximum": 120,
                        "minimum": 1
                    },
                    "proxima_manutencao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Next maintenance"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "ativo",
                            "manutencao",
                            "inativo",
                            "abatido"
                        ],
                        "x-enum-rotulos": {
                            "ativo": "Active",
                            "manutencao": "Under maintenance",
                            "inativo": "Inactive",
                            "abatido": "Decommissioned"
                        },
                        "default": "ativo"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 5000
                    }
                },
                "required": [
                    "nome"
                ]
            },
            "Recurso_equipamentos_registos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "equipamento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Equipment item",
                        "x-anagen-recurso": "equipamentos"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "manutencao",
                            "calibracao",
                            "incidente",
                            "verificacao"
                        ],
                        "x-enum-rotulos": {
                            "manutencao": "Maintenance",
                            "calibracao": "Calibration",
                            "incidente": "Incident",
                            "verificacao": "Check"
                        }
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date"
                    },
                    "resultado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Result",
                        "enum": [
                            "conforme",
                            "nao_conforme",
                            "pendente"
                        ],
                        "x-enum-rotulos": {
                            "conforme": "Compliant",
                            "nao_conforme": "Non-compliant",
                            "pendente": "Pending"
                        }
                    },
                    "entidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Performed by",
                        "maxLength": 160
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person in charge",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 10000
                    },
                    "proxima_data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Next date",
                        "description": "If left blank, it is calculated from the equipment’s maintenance interval."
                    },
                    "notificado_infarmed": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Notified to Infarmed"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Report"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_equipamentos_registos_Entrada": {
                "type": "object",
                "properties": {
                    "equipamento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Equipment item",
                        "x-anagen-recurso": "equipamentos"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "manutencao",
                            "calibracao",
                            "incidente",
                            "verificacao"
                        ],
                        "x-enum-rotulos": {
                            "manutencao": "Maintenance",
                            "calibracao": "Calibration",
                            "incidente": "Incident",
                            "verificacao": "Check"
                        }
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date"
                    },
                    "resultado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Result",
                        "enum": [
                            "conforme",
                            "nao_conforme",
                            "pendente"
                        ],
                        "x-enum-rotulos": {
                            "conforme": "Compliant",
                            "nao_conforme": "Non-compliant",
                            "pendente": "Pending"
                        }
                    },
                    "entidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Performed by",
                        "maxLength": 160
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person in charge",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 10000
                    },
                    "proxima_data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Next date",
                        "description": "If left blank, it is calculated from the equipment’s maintenance interval."
                    },
                    "notificado_infarmed": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Notified to Infarmed"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Report"
                    }
                },
                "required": [
                    "equipamento_id",
                    "tipo",
                    "data"
                ]
            },
            "Recurso_equipas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "chefe_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Team leader",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "membros": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Members",
                        "description": "The team leader always counts as a member.",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-clinico": false
            },
            "Recurso_equipas_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "chefe_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Team leader",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "membros": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Members",
                        "description": "The team leader always counts as a member.",
                        "x-anagen-recurso": "utilizadores"
                    }
                },
                "required": [
                    "nome"
                ]
            },
            "Recurso_feriados": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date"
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "ambito": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Scope",
                        "enum": [
                            "nacional",
                            "municipal",
                            "clinica"
                        ],
                        "x-enum-rotulos": {
                            "nacional": "National",
                            "municipal": "Municipal",
                            "clinica": "Clinic"
                        },
                        "default": "nacional"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-clinico": false
            },
            "Recurso_feriados_Entrada": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date"
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "ambito": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Scope",
                        "enum": [
                            "nacional",
                            "municipal",
                            "clinica"
                        ],
                        "x-enum-rotulos": {
                            "nacional": "National",
                            "municipal": "Municipal",
                            "clinica": "Clinic"
                        },
                        "default": "nacional"
                    }
                },
                "required": [
                    "data",
                    "nome"
                ]
            },
            "Recurso_formacoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "tema": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Topic",
                        "enum": [
                            "protecao_dados",
                            "ia",
                            "sigilo",
                            "captura_3d",
                            "seguranca_informacao",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "protecao_dados": "Data protection",
                            "ia": "Artificial intelligence",
                            "sigilo": "Professional confidentiality",
                            "captura_3d": "3D capture",
                            "seguranca_informacao": "Information security",
                            "outro": "Other"
                        }
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date"
                    },
                    "horas": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Hours",
                        "maximum": 500,
                        "minimum": 0,
                        "x-unidade": "h",
                        "x-casas": 1
                    },
                    "entidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Training provider",
                        "maxLength": 160
                    },
                    "validade_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until",
                        "description": "If left blank, it is valid for the period set in Settings."
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Certificate"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_formacoes_Entrada": {
                "type": "object",
                "properties": {
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "tema": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Topic",
                        "enum": [
                            "protecao_dados",
                            "ia",
                            "sigilo",
                            "captura_3d",
                            "seguranca_informacao",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "protecao_dados": "Data protection",
                            "ia": "Artificial intelligence",
                            "sigilo": "Professional confidentiality",
                            "captura_3d": "3D capture",
                            "seguranca_informacao": "Information security",
                            "outro": "Other"
                        }
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date"
                    },
                    "horas": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Hours",
                        "maximum": 500,
                        "minimum": 0,
                        "x-unidade": "h",
                        "x-casas": 1
                    },
                    "entidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Training provider",
                        "maxLength": 160
                    },
                    "validade_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until",
                        "description": "If left blank, it is valid for the period set in Settings."
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Certificate"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    }
                },
                "required": [
                    "utilizador_id",
                    "tema",
                    "data"
                ]
            },
            "Recurso_formularios": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Internal key",
                        "description": "Lower-case identifier with no spaces (e.g. anamnese_capilar). Links the translations of the same form.",
                        "maxLength": 60,
                        "pattern": "/^[a-z][a-z0-9_]{1,59}$/"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 400
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "anamnese",
                            "questionario_previo",
                            "seguimento",
                            "satisfacao",
                            "pre_avaliacao",
                            "tecnica",
                            "triagem_sintomas",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "anamnese": "Medical history",
                            "questionario_previo": "Pre-consultation questionnaire",
                            "seguimento": "Follow-up",
                            "satisfacao": "Satisfaction",
                            "pre_avaliacao": "Pre-assessment",
                            "tecnica": "By technique",
                            "triagem_sintomas": "Symptom triage",
                            "outro": "Other"
                        },
                        "default": "outro"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Technique",
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "FUE": "FUE",
                            "FUT": "FUT",
                            "DHI": "DHI",
                            "outra": "Other"
                        }
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese (Portugal)",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "expira_dias": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Request validity (days)",
                        "description": "Days the link sent to the patient stays valid. Leave empty to use the period set in Settings.",
                        "maximum": 365,
                        "minimum": 1
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "modelo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Library template",
                        "description": "Available in the builder’s template library."
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "origem_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Source form",
                        "x-anagen-recurso": "formularios",
                        "readOnly": true
                    },
                    "publicado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Published on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-clinico": false
            },
            "Recurso_formularios_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Internal key",
                        "description": "Lower-case identifier with no spaces (e.g. anamnese_capilar). Links the translations of the same form.",
                        "maxLength": 60,
                        "pattern": "/^[a-z][a-z0-9_]{1,59}$/"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 400
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "anamnese",
                            "questionario_previo",
                            "seguimento",
                            "satisfacao",
                            "pre_avaliacao",
                            "tecnica",
                            "triagem_sintomas",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "anamnese": "Medical history",
                            "questionario_previo": "Pre-consultation questionnaire",
                            "seguimento": "Follow-up",
                            "satisfacao": "Satisfaction",
                            "pre_avaliacao": "Pre-assessment",
                            "tecnica": "By technique",
                            "triagem_sintomas": "Symptom triage",
                            "outro": "Other"
                        },
                        "default": "outro"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Technique",
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "FUE": "FUE",
                            "FUT": "FUT",
                            "DHI": "DHI",
                            "outra": "Other"
                        }
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese (Portugal)",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "expira_dias": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Request validity (days)",
                        "description": "Days the link sent to the patient stays valid. Leave empty to use the period set in Settings.",
                        "maximum": 365,
                        "minimum": 1
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "modelo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Library template",
                        "description": "Available in the builder’s template library."
                    }
                },
                "required": [
                    "nome",
                    "tipo",
                    "idioma"
                ]
            },
            "Recurso_formularios_respostas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "formulario_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Form",
                        "x-anagen-recurso": "formularios",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "x-anagen-recurso": "episodios",
                        "readOnly": true
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source",
                        "enum": [
                            "paciente",
                            "equipa",
                            "agente",
                            "site"
                        ],
                        "x-enum-rotulos": {
                            "paciente": "Patient",
                            "equipa": "Team",
                            "agente": "Virtual agent",
                            "site": "Website"
                        },
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pendente",
                            "por_validar",
                            "validado",
                            "rejeitado",
                            "expirado"
                        ],
                        "x-enum-rotulos": {
                            "pendente": "Pending",
                            "por_validar": "Awaiting validation",
                            "validado": "Validated",
                            "rejeitado": "Rejected",
                            "expirado": "Expired"
                        },
                        "readOnly": true
                    },
                    "pontuacao": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Score",
                        "x-casas": 1,
                        "readOnly": true
                    },
                    "alarme": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Warning sign",
                        "readOnly": true
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "email",
                            "sms",
                            "whatsapp",
                            "ligacao",
                            "portal",
                            "presencial"
                        ],
                        "x-enum-rotulos": {
                            "email": "Email",
                            "sms": "SMS",
                            "whatsapp": "WhatsApp",
                            "ligacao": "Link only (share manually)",
                            "portal": "Patient portal",
                            "presencial": "In person"
                        },
                        "readOnly": true
                    },
                    "enviado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Sent by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "enviado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Sent on",
                        "readOnly": true
                    },
                    "expira_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Expires on",
                        "readOnly": true
                    },
                    "preenchido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Completed on",
                        "readOnly": true
                    },
                    "validado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Validated by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "validado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Validated on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-clinico": true
            },
            "Recurso_formularios_respostas_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_fotos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Image"
                    },
                    "captura_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Capture",
                        "x-anagen-recurso": "capturas"
                    },
                    "marco_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Milestone",
                        "x-anagen-recurso": "marcos_acompanhamento"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Date"
                    },
                    "vista": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "View",
                        "maxLength": 40
                    },
                    "zona": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Zone",
                        "enum": [
                            "linha_frontal",
                            "tufo_central",
                            "frontal",
                            "tempora_esq",
                            "tempora_dir",
                            "media",
                            "coroa",
                            "occipital",
                            "parietal_esq",
                            "parietal_dir",
                            "barba",
                            "corpo",
                            "sobrancelha",
                            "dadora",
                            "rosto",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "linha_frontal": "Hairline",
                            "tufo_central": "Forelock",
                            "frontal": "Frontal",
                            "tempora_esq": "Left temple",
                            "tempora_dir": "Right temple",
                            "media": "Mid-scalp",
                            "coroa": "Crown",
                            "occipital": "Occipital",
                            "parietal_esq": "Left parietal",
                            "parietal_dir": "Right parietal",
                            "barba": "Beard",
                            "corpo": "Body",
                            "sobrancelha": "Eyebrow",
                            "dadora": "Donor area",
                            "rosto": "Face",
                            "outra": "Other"
                        }
                    },
                    "etiquetas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Tags",
                        "description": "JSON list, e.g. [\"hairline\", \"check-up\"]."
                    },
                    "album": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Album",
                        "maxLength": 80
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source",
                        "enum": [
                            "equipa",
                            "portal",
                            "whatsapp",
                            "teleconsulta"
                        ],
                        "x-enum-rotulos": {
                            "equipa": "Team",
                            "portal": "Portal",
                            "whatsapp": "WhatsApp",
                            "teleconsulta": "Teleconsultation"
                        },
                        "readOnly": true,
                        "default": "equipa"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "por_verificar",
                            "aceite",
                            "rejeitada"
                        ],
                        "x-enum-rotulos": {
                            "por_verificar": "To check",
                            "aceite": "Accepted",
                            "rejeitada": "Rejected"
                        },
                        "default": "aceite"
                    },
                    "resposta": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reply to the patient",
                        "maxLength": 1000,
                        "x-anagen-cifrado": "clinico"
                    },
                    "partilhada_paciente": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Shared with the patient"
                    },
                    "qualidade_ok": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Sufficient quality",
                        "readOnly": true
                    },
                    "rosto_desfocado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Face blurred",
                        "readOnly": true
                    },
                    "original_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Original",
                        "x-anagen-recurso": "fotos",
                        "readOnly": true
                    },
                    "simulacao": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Simulation",
                        "readOnly": true
                    },
                    "plano_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Plan",
                        "x-anagen-recurso": "planos",
                        "readOnly": true
                    },
                    "verificado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Checked by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "verificado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Checked on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.fotografias",
                "x-anagen-clinico": true
            },
            "Recurso_fotos_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Image"
                    },
                    "captura_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Capture",
                        "x-anagen-recurso": "capturas"
                    },
                    "marco_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Milestone",
                        "x-anagen-recurso": "marcos_acompanhamento"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Date"
                    },
                    "vista": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "View",
                        "maxLength": 40
                    },
                    "zona": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Zone",
                        "enum": [
                            "linha_frontal",
                            "tufo_central",
                            "frontal",
                            "tempora_esq",
                            "tempora_dir",
                            "media",
                            "coroa",
                            "occipital",
                            "parietal_esq",
                            "parietal_dir",
                            "barba",
                            "corpo",
                            "sobrancelha",
                            "dadora",
                            "rosto",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "linha_frontal": "Hairline",
                            "tufo_central": "Forelock",
                            "frontal": "Frontal",
                            "tempora_esq": "Left temple",
                            "tempora_dir": "Right temple",
                            "media": "Mid-scalp",
                            "coroa": "Crown",
                            "occipital": "Occipital",
                            "parietal_esq": "Left parietal",
                            "parietal_dir": "Right parietal",
                            "barba": "Beard",
                            "corpo": "Body",
                            "sobrancelha": "Eyebrow",
                            "dadora": "Donor area",
                            "rosto": "Face",
                            "outra": "Other"
                        }
                    },
                    "etiquetas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Tags",
                        "description": "JSON list, e.g. [\"hairline\", \"check-up\"]."
                    },
                    "album": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Album",
                        "maxLength": 80
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "por_verificar",
                            "aceite",
                            "rejeitada"
                        ],
                        "x-enum-rotulos": {
                            "por_verificar": "To check",
                            "aceite": "Accepted",
                            "rejeitada": "Rejected"
                        },
                        "default": "aceite"
                    },
                    "resposta": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reply to the patient",
                        "maxLength": 1000,
                        "x-anagen-cifrado": "clinico"
                    },
                    "partilhada_paciente": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Shared with the patient"
                    }
                },
                "required": [
                    "paciente_id",
                    "ficheiro_id"
                ]
            },
            "Recurso_funil_fases": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 80
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "description": "Lowercase and “_” (e.g. consulta_marcada). Used in reports and integrations.",
                        "maxLength": 40,
                        "pattern": "/^[a-z0-9_]+$/"
                    },
                    "funil_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Funnel",
                        "description": "Empty: main funnel. The key repeats in each funnel so indicators and conversions work the same.",
                        "x-anagen-recurso": "funis"
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Colour"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "aberta",
                            "ganha",
                            "perdida"
                        ],
                        "x-enum-rotulos": {
                            "aberta": "Open",
                            "ganha": "Won",
                            "perdida": "Lost"
                        },
                        "default": "aberta"
                    },
                    "sla_horas": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Response target in stage",
                        "description": "For the first reply to a lead entering this stage.",
                        "maximum": 2160,
                        "minimum": 0,
                        "x-unidade": "h"
                    },
                    "tarefas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Tasks on entry",
                        "description": "List of {\"titulo\", \"prazo_horas\", \"prioridade\"}; {nome} is the lead name."
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-clinico": false
            },
            "Recurso_funil_fases_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 80
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "description": "Lowercase and “_” (e.g. consulta_marcada). Used in reports and integrations.",
                        "maxLength": 40,
                        "pattern": "/^[a-z0-9_]+$/"
                    },
                    "funil_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Funnel",
                        "description": "Empty: main funnel. The key repeats in each funnel so indicators and conversions work the same.",
                        "x-anagen-recurso": "funis"
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Colour"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "aberta",
                            "ganha",
                            "perdida"
                        ],
                        "x-enum-rotulos": {
                            "aberta": "Open",
                            "ganha": "Won",
                            "perdida": "Lost"
                        },
                        "default": "aberta"
                    },
                    "sla_horas": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Response target in stage",
                        "description": "For the first reply to a lead entering this stage.",
                        "maximum": 2160,
                        "minimum": 0,
                        "x-unidade": "h"
                    },
                    "tarefas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Tasks on entry",
                        "description": "List of {\"titulo\", \"prazo_horas\", \"prioridade\"}; {nome} is the lead name."
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "chave",
                    "ordem",
                    "tipo"
                ]
            },
            "Recurso_funis": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255
                    },
                    "paises": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Countries",
                        "description": "Two-letter codes separated by commas (e.g. BR, AO, MZ).",
                        "maxLength": 400
                    },
                    "idiomas": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "pt-PT",
                                "pt-BR",
                                "en",
                                "es",
                                "fr",
                                "de"
                            ]
                        },
                        "title": "Languages",
                        "description": "Leads in these languages enter this funnel (Portuguese from Portugal stays in the main one).",
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        }
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Colour"
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "description": "When a lead matches several funnels, the lowest order wins.",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 10
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-clinico": false
            },
            "Recurso_funis_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255
                    },
                    "paises": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Countries",
                        "description": "Two-letter codes separated by commas (e.g. BR, AO, MZ).",
                        "maxLength": 400
                    },
                    "idiomas": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "pt-PT",
                                "pt-BR",
                                "en",
                                "es",
                                "fr",
                                "de"
                            ]
                        },
                        "title": "Languages",
                        "description": "Leads in these languages enter this funnel (Portuguese from Portugal stays in the main one).",
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        }
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Colour"
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "description": "When a lead matches several funnels, the lowest order wins.",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 10
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome"
                ]
            },
            "Recurso_guioes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "primeiro_contacto",
                            "confirmacao",
                            "proposta_parada",
                            "reativacao",
                            "pos_operatorio",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "primeiro_contacto": "First contact",
                            "confirmacao": "Confirmation",
                            "proposta_parada": "Stalled proposal",
                            "reativacao": "Reactivation",
                            "pos_operatorio": "Post-operative",
                            "outro": "Other"
                        },
                        "default": "primeiro_contacto"
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purpose",
                        "enum": [
                            "servico",
                            "comercial"
                        ],
                        "x-enum-rotulos": {
                            "servico": "Service",
                            "comercial": "Marketing"
                        },
                        "default": "servico"
                    },
                    "abertura": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Opening (identification and purpose)",
                        "description": "Read at the start of every call. Use {colaborador} and {clinica}.",
                        "maxLength": 1000
                    },
                    "passos": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Steps",
                        "description": "List of {\"titulo\", \"texto\"}."
                    },
                    "campos_obrigatorios": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Required fields",
                        "description": "List of {\"chave\", \"rotulo\", \"tipo\": texto|escolha|booleano|data, \"opcoes\"}."
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-clinico": false
            },
            "Recurso_guioes_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "primeiro_contacto",
                            "confirmacao",
                            "proposta_parada",
                            "reativacao",
                            "pos_operatorio",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "primeiro_contacto": "First contact",
                            "confirmacao": "Confirmation",
                            "proposta_parada": "Stalled proposal",
                            "reativacao": "Reactivation",
                            "pos_operatorio": "Post-operative",
                            "outro": "Other"
                        },
                        "default": "primeiro_contacto"
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purpose",
                        "enum": [
                            "servico",
                            "comercial"
                        ],
                        "x-enum-rotulos": {
                            "servico": "Service",
                            "comercial": "Marketing"
                        },
                        "default": "servico"
                    },
                    "abertura": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Opening (identification and purpose)",
                        "description": "Read at the start of every call. Use {colaborador} and {clinica}.",
                        "maxLength": 1000
                    },
                    "passos": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Steps",
                        "description": "List of {\"titulo\", \"texto\"}."
                    },
                    "campos_obrigatorios": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Required fields",
                        "description": "List of {\"chave\", \"rotulo\", \"tipo\": texto|escolha|booleano|data, \"opcoes\"}."
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "tipo",
                    "finalidade",
                    "abertura"
                ]
            },
            "Recurso_honorarios": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Doctor",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "ato": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical act",
                        "maxLength": 60,
                        "pattern": "^[a-z0-9_]{2,60}$",
                        "default": "manual"
                    },
                    "ato_descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description of the act",
                        "maxLength": 190
                    },
                    "data_ato": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date of the act"
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Surgery"
                    },
                    "consulta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Consultation",
                        "minimum": 1
                    },
                    "base_calculo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Calculation basis",
                        "enum": [
                            "fixo",
                            "por_enxerto",
                            "percentagem_ato",
                            "manual"
                        ],
                        "x-enum-rotulos": {
                            "fixo": "Fixed amount per act",
                            "por_enxerto": "Per implanted graft",
                            "percentagem_ato": "Percentage of the act value",
                            "manual": "Manual record"
                        },
                        "readOnly": true
                    },
                    "quantidade": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Quantity",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Amount",
                        "maximum": 100000,
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "devido",
                            "pago"
                        ],
                        "x-enum-rotulos": {
                            "devido": "Due",
                            "pago": "Paid"
                        },
                        "readOnly": true,
                        "default": "devido"
                    },
                    "pago_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Paid on",
                        "readOnly": true
                    },
                    "referencia_pagamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Payment reference",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 500
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.valores",
                "x-anagen-clinico": false
            },
            "Recurso_honorarios_Entrada": {
                "type": "object",
                "properties": {
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Doctor",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "ato": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical act",
                        "maxLength": 60,
                        "pattern": "^[a-z0-9_]{2,60}$",
                        "default": "manual"
                    },
                    "ato_descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description of the act",
                        "maxLength": 190
                    },
                    "data_ato": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date of the act"
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Surgery"
                    },
                    "consulta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Consultation",
                        "minimum": 1
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Amount",
                        "maximum": 100000,
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 500
                    }
                },
                "required": [
                    "utilizador_id",
                    "ato",
                    "data_ato",
                    "valor"
                ]
            },
            "Recurso_horarios": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Practitioner",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "recurso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Room or resource",
                        "description": "Usual room for these hours (or the hours of the resource itself).",
                        "x-anagen-recurso": "recursos_agenda"
                    },
                    "dia_semana": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Day of the week",
                        "enum": [
                            "1",
                            "2",
                            "3",
                            "4",
                            "5",
                            "6",
                            "7"
                        ],
                        "x-enum-rotulos": {
                            "1": "Monday",
                            "2": "Tuesday",
                            "3": "Wednesday",
                            "4": "Thursday",
                            "5": "Friday",
                            "6": "Saturday",
                            "7": "Sunday"
                        }
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "End"
                    },
                    "tipos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Allowed types",
                        "description": "Empty = all types.",
                        "x-anagen-recurso": "marcacao_tipos"
                    },
                    "valido_de": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valido_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-clinico": false
            },
            "Recurso_horarios_Entrada": {
                "type": "object",
                "properties": {
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Practitioner",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "recurso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Room or resource",
                        "description": "Usual room for these hours (or the hours of the resource itself).",
                        "x-anagen-recurso": "recursos_agenda"
                    },
                    "dia_semana": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Day of the week",
                        "enum": [
                            "1",
                            "2",
                            "3",
                            "4",
                            "5",
                            "6",
                            "7"
                        ],
                        "x-enum-rotulos": {
                            "1": "Monday",
                            "2": "Tuesday",
                            "3": "Wednesday",
                            "4": "Thursday",
                            "5": "Friday",
                            "6": "Saturday",
                            "7": "Sunday"
                        }
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "End"
                    },
                    "tipos": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Allowed types",
                        "description": "Empty = all types.",
                        "x-anagen-recurso": "marcacao_tipos"
                    },
                    "valido_de": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valido_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    }
                },
                "required": [
                    "dia_semana",
                    "inicio",
                    "fim"
                ]
            },
            "Recurso_ia_pedidos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "tarefa": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Use",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Service",
                        "enum": [
                            "ollama",
                            "openrouter"
                        ],
                        "x-enum-rotulos": {
                            "ollama": "Local AI service",
                            "openrouter": "External AI service"
                        },
                        "readOnly": true
                    },
                    "modelo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Model",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "ok",
                            "recurso",
                            "erro"
                        ],
                        "x-enum-rotulos": {
                            "ok": "Answered",
                            "recurso": "Answered by the alternative",
                            "erro": "Failed"
                        },
                        "readOnly": true
                    },
                    "duracao_ms": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Duration",
                        "x-unidade": "ms",
                        "readOnly": true
                    },
                    "tokens_entrada": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Input units",
                        "readOnly": true
                    },
                    "tokens_saida": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Output units",
                        "readOnly": true
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Requested by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "erro": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Error",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "entrada_hash": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Input fingerprint",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-clinico": false
            },
            "Recurso_ia_pedidos_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_ia_propostas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "consulta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Consultation",
                        "x-anagen-recurso": "consultas",
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "escriba",
                            "pre_analise",
                            "resumo",
                            "rascunho_resposta",
                            "triagem"
                        ],
                        "x-enum-rotulos": {
                            "escriba": "Clinical scribe",
                            "pre_analise": "Photograph pre-analysis",
                            "resumo": "Pre-consultation summary",
                            "rascunho_resposta": "Draft reply",
                            "triagem": "Symptom triage"
                        },
                        "readOnly": true
                    },
                    "campo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Field",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "valor_proposto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Proposed value",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "excerto_origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source excerpt",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "fatores": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Factors",
                        "readOnly": true
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Service",
                        "enum": [
                            "ollama",
                            "openrouter"
                        ],
                        "x-enum-rotulos": {
                            "ollama": "Clinic’s private service",
                            "openrouter": "External service (fallback)"
                        },
                        "readOnly": true
                    },
                    "modelo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Model",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "parametros": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Parameters",
                        "readOnly": true
                    },
                    "confianca": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Confidence",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pendente",
                            "aceite",
                            "corrigida",
                            "recusada"
                        ],
                        "x-enum-rotulos": {
                            "pendente": "Pending",
                            "aceite": "Accepted",
                            "corrigida": "Corrected",
                            "recusada": "Declined"
                        },
                        "readOnly": true
                    },
                    "valor_final": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Final value",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "decidido_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Decided by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "decidido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Decided on",
                        "readOnly": true
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "ia_pedido_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Source request",
                        "x-anagen-recurso": "ia_pedidos",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-clinico": true
            },
            "Recurso_ia_propostas_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_imagens_marketing": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 160
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "resultado",
                            "antes_depois",
                            "testemunho",
                            "institucional"
                        ],
                        "x-enum-rotulos": {
                            "resultado": "Result",
                            "antes_depois": "Before and after",
                            "testemunho": "Testimonial",
                            "institucional": "Corporate"
                        },
                        "default": "resultado"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Image"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "description": "Empty for corporate images without identifiable people.",
                        "x-anagen-recurso": "pacientes"
                    },
                    "consentimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Consent no.",
                        "description": "The patient’s “images for communication” consent (record → Consents).",
                        "minimum": 1
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "canais": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "email",
                                "site",
                                "redes",
                                "impressos",
                                "whatsapp"
                            ]
                        },
                        "title": "Allowed channels",
                        "x-enum-rotulos": {
                            "email": "Email",
                            "site": "Website",
                            "redes": "Social media",
                            "impressos": "Print",
                            "whatsapp": "WhatsApp"
                        }
                    },
                    "valido_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "May be used until"
                    },
                    "retocada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Retouched image",
                        "description": "Retouched images are not accepted."
                    },
                    "simulacao": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Simulation or generated image",
                        "description": "Simulations are blocked for communications."
                    },
                    "identificavel_ers": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Person identifiable by the regulator",
                        "description": "The testimonial must match an identifiable patient if the regulator asks."
                    },
                    "testemunho": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Testimonial",
                        "maxLength": 2000
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "ativa",
                            "retirada"
                        ],
                        "x-enum-rotulos": {
                            "ativa": "Active",
                            "retirada": "Withdrawn"
                        },
                        "readOnly": true
                    },
                    "motivo_retirada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Withdrawal reason",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-clinico": false
            },
            "Recurso_imagens_marketing_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 160
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "resultado",
                            "antes_depois",
                            "testemunho",
                            "institucional"
                        ],
                        "x-enum-rotulos": {
                            "resultado": "Result",
                            "antes_depois": "Before and after",
                            "testemunho": "Testimonial",
                            "institucional": "Corporate"
                        },
                        "default": "resultado"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Image"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "description": "Empty for corporate images without identifiable people.",
                        "x-anagen-recurso": "pacientes"
                    },
                    "consentimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Consent no.",
                        "description": "The patient’s “images for communication” consent (record → Consents).",
                        "minimum": 1
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "canais": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "email",
                                "site",
                                "redes",
                                "impressos",
                                "whatsapp"
                            ]
                        },
                        "title": "Allowed channels",
                        "x-enum-rotulos": {
                            "email": "Email",
                            "site": "Website",
                            "redes": "Social media",
                            "impressos": "Print",
                            "whatsapp": "WhatsApp"
                        }
                    },
                    "valido_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "May be used until"
                    },
                    "retocada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Retouched image",
                        "description": "Retouched images are not accepted."
                    },
                    "simulacao": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Simulation or generated image",
                        "description": "Simulations are blocked for communications."
                    },
                    "identificavel_ers": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Person identifiable by the regulator",
                        "description": "The testimonial must match an identifiable patient if the regulator asks."
                    },
                    "testemunho": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Testimonial",
                        "maxLength": 2000
                    }
                },
                "required": [
                    "titulo",
                    "tipo",
                    "ficheiro_id",
                    "canais",
                    "valido_ate"
                ]
            },
            "Recurso_importacoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "pacientes",
                            "consultas",
                            "alertas",
                            "episodios"
                        ],
                        "x-enum-rotulos": {
                            "pacientes": "Patients",
                            "consultas": "Consultations",
                            "alertas": "Clinical alerts",
                            "episodios": "Episodes"
                        },
                        "readOnly": true
                    },
                    "ficheiro": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "File",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "total": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Rows",
                        "readOnly": true
                    },
                    "importados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Imported",
                        "readOnly": true
                    },
                    "duplicados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Duplicates",
                        "readOnly": true
                    },
                    "erros": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Errors",
                        "readOnly": true
                    },
                    "relatorio": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Row-by-row report",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-clinico": false
            },
            "Recurso_importacoes_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_incidentes_seguranca": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "gravidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Severity",
                        "enum": [
                            "baixa",
                            "media",
                            "alta",
                            "critica"
                        ],
                        "x-enum-rotulos": {
                            "baixa": "Low",
                            "media": "Medium",
                            "alta": "High",
                            "critica": "Critical"
                        },
                        "default": "media"
                    },
                    "risco": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Risk to data subjects",
                        "description": "«Risk» requires notifying the CNPD; «high risk» also requires informing the data subjects (GDPR, Arts. 33 and 34).",
                        "enum": [
                            "por_avaliar",
                            "improvavel",
                            "risco",
                            "risco_elevado"
                        ],
                        "x-enum-rotulos": {
                            "por_avaliar": "To be assessed",
                            "improvavel": "Risk unlikely",
                            "risco": "Risk",
                            "risco_elevado": "High risk"
                        },
                        "default": "por_avaliar"
                    },
                    "detetado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Detected on"
                    },
                    "ocorrido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Occurred on"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "What happened",
                        "maxLength": 20000,
                        "x-anagen-cifrado": "geral"
                    },
                    "dados_afetados": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "identificacao",
                                "contacto",
                                "saude",
                                "imagens",
                                "financeiros",
                                "credenciais",
                                "gravacoes",
                                "outros"
                            ]
                        },
                        "title": "Data affected",
                        "x-enum-rotulos": {
                            "identificacao": "Identification",
                            "contacto": "Contact details",
                            "saude": "Health",
                            "imagens": "Images",
                            "financeiros": "Financial",
                            "credenciais": "Credentials",
                            "gravacoes": "Recordings",
                            "outros": "Other"
                        }
                    },
                    "titulares_n": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Data subjects affected",
                        "minimum": 0
                    },
                    "notificar_cnpd": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Notify the CNPD",
                        "description": "Mandatory unless the breach is unlikely to result in a risk to data subjects.",
                        "default": 1
                    },
                    "prazo_cnpd": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "CNPD deadline",
                        "readOnly": true
                    },
                    "notificado_cnpd_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Notified to the CNPD on",
                        "readOnly": true
                    },
                    "cnpd_referencia": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "CNPD reference",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "notificar_titulares": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Inform data subjects",
                        "description": "Mandatory when the risk is high."
                    },
                    "notificados_titulares_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Data subjects informed on",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "aberto",
                            "em_analise",
                            "contido",
                            "notificado",
                            "encerrado"
                        ],
                        "x-enum-rotulos": {
                            "aberto": "Open",
                            "em_analise": "Under review",
                            "contido": "Contained",
                            "notificado": "Notified",
                            "encerrado": "Closed"
                        },
                        "default": "aberto"
                    },
                    "medidas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Measures taken",
                        "maxLength": 20000,
                        "x-anagen-cifrado": "geral"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person in charge",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "encerrado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Closed on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_incidentes_seguranca_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "gravidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Severity",
                        "enum": [
                            "baixa",
                            "media",
                            "alta",
                            "critica"
                        ],
                        "x-enum-rotulos": {
                            "baixa": "Low",
                            "media": "Medium",
                            "alta": "High",
                            "critica": "Critical"
                        },
                        "default": "media"
                    },
                    "risco": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Risk to data subjects",
                        "description": "«Risk» requires notifying the CNPD; «high risk» also requires informing the data subjects (GDPR, Arts. 33 and 34).",
                        "enum": [
                            "por_avaliar",
                            "improvavel",
                            "risco",
                            "risco_elevado"
                        ],
                        "x-enum-rotulos": {
                            "por_avaliar": "To be assessed",
                            "improvavel": "Risk unlikely",
                            "risco": "Risk",
                            "risco_elevado": "High risk"
                        },
                        "default": "por_avaliar"
                    },
                    "detetado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Detected on"
                    },
                    "ocorrido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Occurred on"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "What happened",
                        "maxLength": 20000,
                        "x-anagen-cifrado": "geral"
                    },
                    "dados_afetados": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "identificacao",
                                "contacto",
                                "saude",
                                "imagens",
                                "financeiros",
                                "credenciais",
                                "gravacoes",
                                "outros"
                            ]
                        },
                        "title": "Data affected",
                        "x-enum-rotulos": {
                            "identificacao": "Identification",
                            "contacto": "Contact details",
                            "saude": "Health",
                            "imagens": "Images",
                            "financeiros": "Financial",
                            "credenciais": "Credentials",
                            "gravacoes": "Recordings",
                            "outros": "Other"
                        }
                    },
                    "titulares_n": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Data subjects affected",
                        "minimum": 0
                    },
                    "notificar_cnpd": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Notify the CNPD",
                        "description": "Mandatory unless the breach is unlikely to result in a risk to data subjects.",
                        "default": 1
                    },
                    "notificar_titulares": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Inform data subjects",
                        "description": "Mandatory when the risk is high."
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "aberto",
                            "em_analise",
                            "contido",
                            "notificado",
                            "encerrado"
                        ],
                        "x-enum-rotulos": {
                            "aberto": "Open",
                            "em_analise": "Under review",
                            "contido": "Contained",
                            "notificado": "Notified",
                            "encerrado": "Closed"
                        },
                        "default": "aberto"
                    },
                    "medidas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Measures taken",
                        "maxLength": 20000,
                        "x-anagen-cifrado": "geral"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person in charge",
                        "x-anagen-recurso": "utilizadores"
                    }
                },
                "required": [
                    "titulo",
                    "gravidade",
                    "descricao"
                ]
            },
            "Recurso_itinerarios": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "x-anagen-recurso": "episodios"
                    },
                    "chegada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Arrival"
                    },
                    "voo_chegada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Arrival flight",
                        "maxLength": 60
                    },
                    "partida": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Departure"
                    },
                    "voo_partida": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Departure flight",
                        "maxLength": 60
                    },
                    "hotel": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Hotel",
                        "maxLength": 190
                    },
                    "transporte": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Transport",
                        "maxLength": 255
                    },
                    "contacto_local": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Local contact"
                    },
                    "interprete_idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Interpreter language",
                        "enum": [
                            "pt-PT",
                            "en",
                            "es",
                            "fr",
                            "de",
                            "it",
                            "ar",
                            "ru",
                            "zh",
                            "nl"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German",
                            "it": "Italian",
                            "ar": "Arabic",
                            "ru": "Russian",
                            "zh": "Chinese",
                            "nl": "Dutch"
                        }
                    },
                    "interprete_recurso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Interpreter",
                        "description": "Interpreter from the schedule (resource by language), reserved in the appointments.",
                        "x-anagen-recurso": "recursos_agenda"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-clinico": false
            },
            "Recurso_itinerarios_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "x-anagen-recurso": "episodios"
                    },
                    "chegada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Arrival"
                    },
                    "voo_chegada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Arrival flight",
                        "maxLength": 60
                    },
                    "partida": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Departure"
                    },
                    "voo_partida": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Departure flight",
                        "maxLength": 60
                    },
                    "hotel": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Hotel",
                        "maxLength": 190
                    },
                    "transporte": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Transport",
                        "maxLength": 255
                    },
                    "contacto_local": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Local contact"
                    },
                    "interprete_idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Interpreter language",
                        "enum": [
                            "pt-PT",
                            "en",
                            "es",
                            "fr",
                            "de",
                            "it",
                            "ar",
                            "ru",
                            "zh",
                            "nl"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German",
                            "it": "Italian",
                            "ar": "Arabic",
                            "ru": "Russian",
                            "zh": "Chinese",
                            "nl": "Dutch"
                        }
                    },
                    "interprete_recurso_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Interpreter",
                        "description": "Interpreter from the schedule (resource by language), reserved in the appointments.",
                        "x-anagen-recurso": "recursos_agenda"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    }
                },
                "required": [
                    "paciente_id"
                ]
            },
            "Recurso_leads": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone",
                        "description": "With the country code; Portuguese numbers without a code get +351."
                    },
                    "data_nascimento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date of birth"
                    },
                    "nif": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{9}$",
                        "title": "Tax number",
                        "description": "Stored only as a search code (duplicate detection); never readable."
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "pais": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Country",
                        "description": "2-letter code (PT, ES, FR…).",
                        "maxLength": 2,
                        "pattern": "/^[A-Za-z]{2}$/"
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure of interest",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source",
                        "enum": [
                            "site",
                            "pre_avaliacao",
                            "meta",
                            "google",
                            "whatsapp",
                            "instagram",
                            "messenger",
                            "telefone",
                            "presencial",
                            "recomendacao",
                            "agente_voz",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "site": "Website",
                            "pre_avaliacao": "Pre-assessment",
                            "meta": "Meta (ads)",
                            "google": "Google (ads)",
                            "whatsapp": "WhatsApp",
                            "instagram": "Instagram",
                            "messenger": "Messenger",
                            "telefone": "Phone",
                            "presencial": "Walk-in",
                            "recomendacao": "Referral",
                            "agente_voz": "Voice agent",
                            "outro": "Other"
                        },
                        "default": "presencial"
                    },
                    "campanha": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Campaign",
                        "maxLength": 120
                    },
                    "anuncio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Ad",
                        "maxLength": 120
                    },
                    "utm_source": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_source",
                        "maxLength": 120
                    },
                    "utm_medium": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_medium",
                        "maxLength": 120
                    },
                    "utm_campaign": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_campaign",
                        "maxLength": 120
                    },
                    "utm_term": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_term",
                        "maxLength": 120
                    },
                    "utm_content": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_content",
                        "maxLength": 120
                    },
                    "clique_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Click ID",
                        "description": "Ad click identifier (to return conversions, only with a legal basis).",
                        "maxLength": 255
                    },
                    "clique_tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Click identifier type",
                        "enum": [
                            "gclid",
                            "gbraid",
                            "wbraid",
                            "fbclid",
                            "ttclid",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "gclid": "Google (click)",
                            "gbraid": "Google (app)",
                            "wbraid": "Google (web)",
                            "fbclid": "Meta (click)",
                            "ttclid": "TikTok (click)",
                            "outro": "Other"
                        }
                    },
                    "lead_externo_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Lead on the ad platform",
                        "description": "Identifier of the ad form that created this lead.",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "funil_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Funnel",
                        "description": "Empty: main funnel. Chosen by country and language when the lead arrives.",
                        "x-anagen-recurso": "funis",
                        "readOnly": true
                    },
                    "fase_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Stage",
                        "x-anagen-recurso": "funil_fases"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Owner",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "pontuacao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Score",
                        "maximum": 100,
                        "minimum": 0,
                        "readOnly": true
                    },
                    "decisao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Decision",
                        "enum": [
                            "por_decidir",
                            "confirmado",
                            "indeciso",
                            "recusado"
                        ],
                        "x-enum-rotulos": {
                            "por_decidir": "Undecided yet",
                            "confirmado": "Confirmed",
                            "indeciso": "Hesitant",
                            "recusado": "Declined"
                        },
                        "default": "por_decidir"
                    },
                    "motivo_indecisao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason for hesitation or refusal",
                        "maxLength": 255
                    },
                    "valor_estimado": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Estimated value",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "x-anagen-permissao": "financeiro.valores"
                    },
                    "motivo_perda": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Loss reason",
                        "enum": [
                            "preco",
                            "prazo",
                            "concorrencia",
                            "nao_elegivel",
                            "sem_resposta",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "preco": "Price",
                            "prazo": "Timing",
                            "concorrencia": "Competitor",
                            "nao_elegivel": "Not eligible",
                            "sem_resposta": "No response",
                            "outro": "Other"
                        }
                    },
                    "motivo_perda_detalhe": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Loss reason details",
                        "maxLength": 255
                    },
                    "recomendado_por_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Referred by",
                        "x-anagen-recurso": "pacientes"
                    },
                    "recompensa_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reward",
                        "enum": [
                            "pendente",
                            "atribuida"
                        ],
                        "x-enum-rotulos": {
                            "pendente": "Pending",
                            "atribuida": "Granted"
                        }
                    },
                    "consentimento_contacto": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Agreed to be contacted about the request",
                        "description": "Contact about their own request. Marketing messages need a separate marketing consent."
                    },
                    "proxima_acao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Next action",
                        "maxLength": 190
                    },
                    "proxima_acao_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Next action date"
                    },
                    "sla_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Reply by",
                        "readOnly": true
                    },
                    "primeira_resposta_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "First reply",
                        "readOnly": true
                    },
                    "ultimo_contacto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last contact",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "duplicado_de": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Possible duplicate of",
                        "x-anagen-recurso": "leads",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 5000,
                        "x-anagen-cifrado": "geral"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-clinico": false
            },
            "Recurso_leads_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone",
                        "description": "With the country code; Portuguese numbers without a code get +351."
                    },
                    "data_nascimento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date of birth"
                    },
                    "nif": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{9}$",
                        "title": "Tax number",
                        "description": "Stored only as a search code (duplicate detection); never readable."
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "pais": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Country",
                        "description": "2-letter code (PT, ES, FR…).",
                        "maxLength": 2,
                        "pattern": "/^[A-Za-z]{2}$/"
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure of interest",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source",
                        "enum": [
                            "site",
                            "pre_avaliacao",
                            "meta",
                            "google",
                            "whatsapp",
                            "instagram",
                            "messenger",
                            "telefone",
                            "presencial",
                            "recomendacao",
                            "agente_voz",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "site": "Website",
                            "pre_avaliacao": "Pre-assessment",
                            "meta": "Meta (ads)",
                            "google": "Google (ads)",
                            "whatsapp": "WhatsApp",
                            "instagram": "Instagram",
                            "messenger": "Messenger",
                            "telefone": "Phone",
                            "presencial": "Walk-in",
                            "recomendacao": "Referral",
                            "agente_voz": "Voice agent",
                            "outro": "Other"
                        },
                        "default": "presencial"
                    },
                    "campanha": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Campaign",
                        "maxLength": 120
                    },
                    "anuncio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Ad",
                        "maxLength": 120
                    },
                    "utm_source": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_source",
                        "maxLength": 120
                    },
                    "utm_medium": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_medium",
                        "maxLength": 120
                    },
                    "utm_campaign": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_campaign",
                        "maxLength": 120
                    },
                    "utm_term": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_term",
                        "maxLength": 120
                    },
                    "utm_content": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_content",
                        "maxLength": 120
                    },
                    "clique_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Click ID",
                        "description": "Ad click identifier (to return conversions, only with a legal basis).",
                        "maxLength": 255
                    },
                    "clique_tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Click identifier type",
                        "enum": [
                            "gclid",
                            "gbraid",
                            "wbraid",
                            "fbclid",
                            "ttclid",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "gclid": "Google (click)",
                            "gbraid": "Google (app)",
                            "wbraid": "Google (web)",
                            "fbclid": "Meta (click)",
                            "ttclid": "TikTok (click)",
                            "outro": "Other"
                        }
                    },
                    "fase_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Stage",
                        "x-anagen-recurso": "funil_fases"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Owner",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "decisao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Decision",
                        "enum": [
                            "por_decidir",
                            "confirmado",
                            "indeciso",
                            "recusado"
                        ],
                        "x-enum-rotulos": {
                            "por_decidir": "Undecided yet",
                            "confirmado": "Confirmed",
                            "indeciso": "Hesitant",
                            "recusado": "Declined"
                        },
                        "default": "por_decidir"
                    },
                    "motivo_indecisao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason for hesitation or refusal",
                        "maxLength": 255
                    },
                    "valor_estimado": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Estimated value",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "x-anagen-permissao": "financeiro.valores"
                    },
                    "motivo_perda": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Loss reason",
                        "enum": [
                            "preco",
                            "prazo",
                            "concorrencia",
                            "nao_elegivel",
                            "sem_resposta",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "preco": "Price",
                            "prazo": "Timing",
                            "concorrencia": "Competitor",
                            "nao_elegivel": "Not eligible",
                            "sem_resposta": "No response",
                            "outro": "Other"
                        }
                    },
                    "motivo_perda_detalhe": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Loss reason details",
                        "maxLength": 255
                    },
                    "recomendado_por_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Referred by",
                        "x-anagen-recurso": "pacientes"
                    },
                    "recompensa_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reward",
                        "enum": [
                            "pendente",
                            "atribuida"
                        ],
                        "x-enum-rotulos": {
                            "pendente": "Pending",
                            "atribuida": "Granted"
                        }
                    },
                    "consentimento_contacto": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Agreed to be contacted about the request",
                        "description": "Contact about their own request. Marketing messages need a separate marketing consent."
                    },
                    "proxima_acao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Next action",
                        "maxLength": 190
                    },
                    "proxima_acao_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Next action date"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 5000,
                        "x-anagen-cifrado": "geral"
                    }
                },
                "required": [
                    "nome",
                    "origem"
                ]
            },
            "Recurso_lista_espera": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "x-anagen-recurso": "leads"
                    },
                    "tipo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Appointment type",
                        "x-anagen-recurso": "marcacao_tipos"
                    },
                    "profissional_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Preferred practitioner",
                        "description": "Empty = any practitioner.",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "preferencias": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Preferences",
                        "description": "E.g. mornings, Tuesdays and Thursdays.",
                        "maxLength": 255
                    },
                    "prioridade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Priority",
                        "enum": [
                            "baixa",
                            "normal",
                            "alta"
                        ],
                        "x-enum-rotulos": {
                            "baixa": "Low",
                            "normal": "Normal",
                            "alta": "High"
                        },
                        "default": "normal"
                    },
                    "desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "On the list since"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "ativa",
                            "contactado",
                            "marcado",
                            "cancelado"
                        ],
                        "x-enum-rotulos": {
                            "ativa": "Waiting",
                            "contactado": "Slot offered",
                            "marcado": "Booked",
                            "cancelado": "Removed from list"
                        },
                        "default": "ativa"
                    },
                    "oferta_inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Slot offered",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-clinico": false
            },
            "Recurso_lista_espera_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "x-anagen-recurso": "leads"
                    },
                    "tipo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Appointment type",
                        "x-anagen-recurso": "marcacao_tipos"
                    },
                    "profissional_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Preferred practitioner",
                        "description": "Empty = any practitioner.",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "preferencias": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Preferences",
                        "description": "E.g. mornings, Tuesdays and Thursdays.",
                        "maxLength": 255
                    },
                    "prioridade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Priority",
                        "enum": [
                            "baixa",
                            "normal",
                            "alta"
                        ],
                        "x-enum-rotulos": {
                            "baixa": "Low",
                            "normal": "Normal",
                            "alta": "High"
                        },
                        "default": "normal"
                    },
                    "desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "On the list since"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "ativa",
                            "contactado",
                            "marcado",
                            "cancelado"
                        ],
                        "x-enum-rotulos": {
                            "ativa": "Waiting",
                            "contactado": "Slot offered",
                            "marcado": "Booked",
                            "cancelado": "Removed from list"
                        },
                        "default": "ativa"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    }
                },
                "required": [
                    "tipo_id"
                ]
            },
            "Recurso_locais": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Location name",
                        "maxLength": 160
                    },
                    "morada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Address",
                        "maxLength": 255
                    },
                    "codigo_postal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{4}-\\d{3}$",
                        "title": "Postcode"
                    },
                    "localidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Town",
                        "maxLength": 100
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email",
                        "maxLength": 190
                    },
                    "principal": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Main location",
                        "description": "There is only one main location; marking this one unmarks the previous one.",
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "description": "Active locations count towards the licence limit.",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-clinico": false
            },
            "Recurso_locais_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Location name",
                        "maxLength": 160
                    },
                    "morada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Address",
                        "maxLength": 255
                    },
                    "codigo_postal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{4}-\\d{3}$",
                        "title": "Postcode"
                    },
                    "localidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Town",
                        "maxLength": 100
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email",
                        "maxLength": 190
                    },
                    "principal": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Main location",
                        "description": "There is only one main location; marking this one unmarks the previous one.",
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "description": "Active locations count towards the licence limit.",
                        "default": 1
                    }
                },
                "required": [
                    "nome"
                ]
            },
            "Recurso_marcacao_tipos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "description": "Fixed lowercase identifier (e.g. primeira_consulta).",
                        "maxLength": 40,
                        "pattern": "/^[a-z0-9_]{2,40}$/"
                    },
                    "duracao_min": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Duration (min)",
                        "maximum": 960,
                        "minimum": 5,
                        "default": 30
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Colour"
                    },
                    "teleconsulta": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "By video (teleconsultation)"
                    },
                    "cirurgia": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Surgical block",
                        "description": "Type used by the surgery board."
                    },
                    "margem_antes_min": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Buffer before (min)",
                        "maximum": 240,
                        "minimum": 0,
                        "default": 0
                    },
                    "margem_depois_min": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Buffer after (min)",
                        "maximum": 240,
                        "minimum": 0,
                        "default": 0
                    },
                    "sala_obrigatoria": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires a room"
                    },
                    "exige_sinal": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires a deposit"
                    },
                    "valor_sinal": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Deposit amount",
                        "maximum": 100000,
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "falta_perde_sinal": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "No-show or late cancellation forfeits the deposit"
                    },
                    "antecedencia_min_h": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Minimum notice for online booking (h)",
                        "description": "Applies to appointments booked by the patient (portal, website, agent).",
                        "maximum": 720,
                        "minimum": 0,
                        "default": 24
                    },
                    "cancelamento_min_h": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Free cancellation up to (hours before)",
                        "maximum": 720,
                        "minimum": 0,
                        "default": 24
                    },
                    "politica_cancelamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Cancellation and no-show policy",
                        "description": "Shown to the patient in the appointment link.",
                        "maxLength": 2000
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "online": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Online booking",
                        "description": "Available in the portal, on the website and through the voice agent."
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-clinico": false
            },
            "Recurso_marcacao_tipos_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "chave": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Key",
                        "description": "Fixed lowercase identifier (e.g. primeira_consulta).",
                        "maxLength": 40,
                        "pattern": "/^[a-z0-9_]{2,40}$/"
                    },
                    "duracao_min": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Duration (min)",
                        "maximum": 960,
                        "minimum": 5,
                        "default": 30
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Colour"
                    },
                    "teleconsulta": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "By video (teleconsultation)"
                    },
                    "cirurgia": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Surgical block",
                        "description": "Type used by the surgery board."
                    },
                    "margem_antes_min": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Buffer before (min)",
                        "maximum": 240,
                        "minimum": 0,
                        "default": 0
                    },
                    "margem_depois_min": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Buffer after (min)",
                        "maximum": 240,
                        "minimum": 0,
                        "default": 0
                    },
                    "sala_obrigatoria": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires a room"
                    },
                    "exige_sinal": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Requires a deposit"
                    },
                    "valor_sinal": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Deposit amount",
                        "maximum": 100000,
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "falta_perde_sinal": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "No-show or late cancellation forfeits the deposit"
                    },
                    "antecedencia_min_h": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Minimum notice for online booking (h)",
                        "description": "Applies to appointments booked by the patient (portal, website, agent).",
                        "maximum": 720,
                        "minimum": 0,
                        "default": 24
                    },
                    "cancelamento_min_h": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Free cancellation up to (hours before)",
                        "maximum": 720,
                        "minimum": 0,
                        "default": 24
                    },
                    "politica_cancelamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Cancellation and no-show policy",
                        "description": "Shown to the patient in the appointment link.",
                        "maxLength": 2000
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "online": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Online booking",
                        "description": "Available in the portal, on the website and through the voice agent."
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "chave",
                    "duracao_min"
                ]
            },
            "Recurso_marcacoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start",
                        "readOnly": true
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "End",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "x-anagen-recurso": "leads",
                        "readOnly": true
                    },
                    "tipo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Type",
                        "x-anagen-recurso": "marcacao_tipos",
                        "readOnly": true
                    },
                    "profissional_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Practitioner",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "sala_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Room",
                        "x-anagen-recurso": "recursos_agenda",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pedido",
                            "marcada",
                            "confirmada",
                            "em_curso",
                            "concluida",
                            "faltou",
                            "cancelada",
                            "remarcada"
                        ],
                        "x-enum-rotulos": {
                            "pedido": "Requested",
                            "marcada": "Awaiting confirmation",
                            "confirmada": "Confirmed",
                            "em_curso": "In progress",
                            "concluida": "Completed",
                            "faltou": "No-show",
                            "cancelada": "Cancelled",
                            "remarcada": "Rescheduled"
                        },
                        "readOnly": true
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source",
                        "enum": [
                            "equipa",
                            "portal",
                            "site",
                            "agente",
                            "telefone"
                        ],
                        "x-enum-rotulos": {
                            "equipa": "Team",
                            "portal": "Portal",
                            "site": "Website",
                            "agente": "Voice agent",
                            "telefone": "Phone"
                        },
                        "readOnly": true
                    },
                    "confirmada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Confirmed on",
                        "readOnly": true
                    },
                    "lembrete_enviado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Reminder sent on",
                        "readOnly": true
                    },
                    "checkin_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Arrival",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "readOnly": true
                    },
                    "motivo_cancelamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Cancellation reason",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-clinico": false
            },
            "Recurso_marcacoes_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_marcos_acompanhamento": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "marco": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Milestone",
                        "enum": [
                            "d1",
                            "s1",
                            "m1",
                            "m2",
                            "m6",
                            "m9",
                            "m12",
                            "m18"
                        ],
                        "x-enum-rotulos": {
                            "d1": "Day 1",
                            "s1": "Week 1",
                            "m1": "Month 1",
                            "m2": "Month 2",
                            "m6": "Month 6",
                            "m9": "Month 9",
                            "m12": "Month 12",
                            "m18": "Month 18"
                        }
                    },
                    "data_prevista": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Expected date"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pendente",
                            "fotos_enviadas",
                            "revisto",
                            "concluido",
                            "em_atraso",
                            "falhado"
                        ],
                        "x-enum-rotulos": {
                            "pendente": "Pending",
                            "fotos_enviadas": "Photos sent",
                            "revisto": "Reviewed",
                            "concluido": "Completed",
                            "em_atraso": "Overdue",
                            "falhado": "Missed"
                        },
                        "default": "pendente"
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "minimum": 1
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Surgery",
                        "minimum": 1
                    },
                    "marcacao_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Appointment",
                        "minimum": 1
                    },
                    "captura_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Capture",
                        "x-anagen-recurso": "capturas",
                        "x-anagen-permissao": "ficha.captura"
                    },
                    "resposta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Questionnaire",
                        "minimum": 1
                    },
                    "nps": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Likelihood to recommend (0–10)",
                        "maximum": 10,
                        "minimum": 0
                    },
                    "densidade_obtida": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Achieved density",
                        "maximum": 250,
                        "minimum": 0,
                        "x-unidade": "UF/cm²",
                        "x-casas": 1,
                        "x-anagen-permissao": "ficha.captura"
                    },
                    "densidades_zona": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Achieved density by zone",
                        "description": "JSON in FU/cm²: {\"linha_frontal\": 23.4, \"coroa\": 17.8}.",
                        "x-anagen-permissao": "ficha.captura"
                    },
                    "metricas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Metrics",
                        "description": "JSON: {\"racio_terminal_vellus\": 4.2, \"calibre_mm\": 0.062, \"pct_terminais\": 78}.",
                        "x-anagen-permissao": "ficha.captura"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "maxLength": 4000,
                        "x-anagen-permissao": "ficha.clinica",
                        "x-anagen-cifrado": "clinico"
                    },
                    "revisto_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Reviewed by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "revisto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Reviewed on",
                        "readOnly": true
                    },
                    "concluido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Completed on",
                        "readOnly": true
                    },
                    "tarefa_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Recall task",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-clinico": true
            },
            "Recurso_marcos_acompanhamento_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "marco": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Milestone",
                        "enum": [
                            "d1",
                            "s1",
                            "m1",
                            "m2",
                            "m6",
                            "m9",
                            "m12",
                            "m18"
                        ],
                        "x-enum-rotulos": {
                            "d1": "Day 1",
                            "s1": "Week 1",
                            "m1": "Month 1",
                            "m2": "Month 2",
                            "m6": "Month 6",
                            "m9": "Month 9",
                            "m12": "Month 12",
                            "m18": "Month 18"
                        }
                    },
                    "data_prevista": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Expected date"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pendente",
                            "fotos_enviadas",
                            "revisto",
                            "concluido",
                            "em_atraso",
                            "falhado"
                        ],
                        "x-enum-rotulos": {
                            "pendente": "Pending",
                            "fotos_enviadas": "Photos sent",
                            "revisto": "Reviewed",
                            "concluido": "Completed",
                            "em_atraso": "Overdue",
                            "falhado": "Missed"
                        },
                        "default": "pendente"
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "minimum": 1
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Surgery",
                        "minimum": 1
                    },
                    "marcacao_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Appointment",
                        "minimum": 1
                    },
                    "captura_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Capture",
                        "x-anagen-recurso": "capturas",
                        "x-anagen-permissao": "ficha.captura"
                    },
                    "resposta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Questionnaire",
                        "minimum": 1
                    },
                    "nps": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Likelihood to recommend (0–10)",
                        "maximum": 10,
                        "minimum": 0
                    },
                    "densidade_obtida": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Achieved density",
                        "maximum": 250,
                        "minimum": 0,
                        "x-unidade": "UF/cm²",
                        "x-casas": 1,
                        "x-anagen-permissao": "ficha.captura"
                    },
                    "densidades_zona": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Achieved density by zone",
                        "description": "JSON in FU/cm²: {\"linha_frontal\": 23.4, \"coroa\": 17.8}.",
                        "x-anagen-permissao": "ficha.captura"
                    },
                    "metricas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Metrics",
                        "description": "JSON: {\"racio_terminal_vellus\": 4.2, \"calibre_mm\": 0.062, \"pct_terminais\": 78}.",
                        "x-anagen-permissao": "ficha.captura"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "maxLength": 4000,
                        "x-anagen-permissao": "ficha.clinica",
                        "x-anagen-cifrado": "clinico"
                    }
                },
                "required": [
                    "paciente_id",
                    "marco",
                    "data_prevista"
                ]
            },
            "Recurso_modelos3d": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Model file"
                    },
                    "captura_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Capture",
                        "x-anagen-recurso": "capturas"
                    },
                    "formato": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Format",
                        "enum": [
                            "glb",
                            "gltf",
                            "obj",
                            "ply",
                            "stl",
                            "usdz"
                        ],
                        "x-enum-rotulos": {
                            "glb": "GLB",
                            "gltf": "glTF",
                            "obj": "OBJ",
                            "ply": "PLY",
                            "stl": "STL",
                            "usdz": "USDZ"
                        },
                        "readOnly": true
                    },
                    "cobertura_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Coverage",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "escala_confirmada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Scale confirmed",
                        "description": "Confirmed with the reference of known size (sticker)."
                    },
                    "qualidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Quality",
                        "enum": [
                            "boa",
                            "aceitavel",
                            "insuficiente"
                        ],
                        "x-enum-rotulos": {
                            "boa": "Good",
                            "aceitavel": "Acceptable",
                            "insuficiente": "Insufficient"
                        }
                    },
                    "referencias": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Anatomical landmarks",
                        "description": "JSON with glabela, tragus_e, tragus_d, occipital and vertice: {\"glabela\": {\"x\": 0, \"y\": 0, \"z\": 0}, …}."
                    },
                    "zonas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Areas by zone",
                        "description": "Areas measured on the mesh, in cm²: {\"linha_frontal\": 15.2, \"coroa\": 68.9}."
                    },
                    "area_dadora_cm2": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Measured donor area",
                        "maximum": 800,
                        "minimum": 0,
                        "x-unidade": "cm²",
                        "x-casas": 1
                    },
                    "partilhado_paciente": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Shared with the patient"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "maxLength": 4000,
                        "x-anagen-cifrado": "clinico"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-clinico": true
            },
            "Recurso_modelos3d_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Model file"
                    },
                    "captura_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Capture",
                        "x-anagen-recurso": "capturas"
                    },
                    "cobertura_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Coverage",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "escala_confirmada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Scale confirmed",
                        "description": "Confirmed with the reference of known size (sticker)."
                    },
                    "qualidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Quality",
                        "enum": [
                            "boa",
                            "aceitavel",
                            "insuficiente"
                        ],
                        "x-enum-rotulos": {
                            "boa": "Good",
                            "aceitavel": "Acceptable",
                            "insuficiente": "Insufficient"
                        }
                    },
                    "referencias": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Anatomical landmarks",
                        "description": "JSON with glabela, tragus_e, tragus_d, occipital and vertice: {\"glabela\": {\"x\": 0, \"y\": 0, \"z\": 0}, …}."
                    },
                    "zonas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Areas by zone",
                        "description": "Areas measured on the mesh, in cm²: {\"linha_frontal\": 15.2, \"coroa\": 68.9}."
                    },
                    "area_dadora_cm2": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Measured donor area",
                        "maximum": 800,
                        "minimum": 0,
                        "x-unidade": "cm²",
                        "x-casas": 1
                    },
                    "partilhado_paciente": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Shared with the patient"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "maxLength": 4000,
                        "x-anagen-cifrado": "clinico"
                    }
                },
                "required": [
                    "paciente_id",
                    "ficheiro_id"
                ]
            },
            "Recurso_motor_versoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "aprovada",
                            "arquivada"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "aprovada": "Approved",
                            "arquivada": "Archived"
                        },
                        "readOnly": true
                    },
                    "base_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Created from",
                        "x-anagen-recurso": "motor_versoes",
                        "readOnly": true
                    },
                    "aprovado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Approved by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Approved on",
                        "readOnly": true
                    },
                    "arquivado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Archived on",
                        "readOnly": true
                    },
                    "finalidade_regulamentar": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Regulatory purpose",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-clinico": false
            },
            "Recurso_motor_versoes_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_objetivos_comerciais": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "periodo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Month",
                        "description": "Format YYYY-MM.",
                        "maxLength": 7,
                        "pattern": "/^\\d{4}-(0[1-9]|1[0-2])$/"
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "equipa_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Team",
                        "x-anagen-recurso": "equipas"
                    },
                    "metrica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Metric",
                        "enum": [
                            "leads_novos",
                            "consultas_marcadas",
                            "propostas",
                            "cirurgias_marcadas",
                            "ganhos",
                            "valor_ganho"
                        ],
                        "x-enum-rotulos": {
                            "leads_novos": "New leads",
                            "consultas_marcadas": "Consultations booked",
                            "propostas": "Proposals",
                            "cirurgias_marcadas": "Surgeries booked",
                            "ganhos": "Won",
                            "valor_ganho": "Value won"
                        }
                    },
                    "alvo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Goal",
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-clinico": false
            },
            "Recurso_objetivos_comerciais_Entrada": {
                "type": "object",
                "properties": {
                    "periodo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Month",
                        "description": "Format YYYY-MM.",
                        "maxLength": 7,
                        "pattern": "/^\\d{4}-(0[1-9]|1[0-2])$/"
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "equipa_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Team",
                        "x-anagen-recurso": "equipas"
                    },
                    "metrica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Metric",
                        "enum": [
                            "leads_novos",
                            "consultas_marcadas",
                            "propostas",
                            "cirurgias_marcadas",
                            "ganhos",
                            "valor_ganho"
                        ],
                        "x-enum-rotulos": {
                            "leads_novos": "New leads",
                            "consultas_marcadas": "Consultations booked",
                            "propostas": "Proposals",
                            "cirurgias_marcadas": "Surgeries booked",
                            "ganhos": "Won",
                            "valor_ganho": "Value won"
                        }
                    },
                    "alvo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Goal",
                        "minimum": 0,
                        "x-casas": 2
                    }
                },
                "required": [
                    "periodo",
                    "metrica",
                    "alvo"
                ]
            },
            "Recurso_pacientes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Record no.",
                        "description": "Assigned automatically when the patient is created.",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "First name",
                        "maxLength": 100
                    },
                    "apelidos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Surname",
                        "maxLength": 120
                    },
                    "nome_completo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Full name",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "sexo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Sex",
                        "enum": [
                            "F",
                            "M",
                            "X"
                        ],
                        "x-enum-rotulos": {
                            "F": "Female",
                            "M": "Male",
                            "X": "Other / not specified"
                        }
                    },
                    "data_nascimento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date of birth",
                        "description": "Required to check the minimum age for eligibility."
                    },
                    "nif": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{9}$",
                        "title": "Tax number",
                        "description": "Stored encrypted. Searched by the full number.",
                        "x-anagen-cifrado": "geral"
                    },
                    "documento_tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Document type",
                        "enum": [
                            "cc",
                            "passaporte",
                            "titulo_residencia",
                            "bi",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "cc": "Portuguese citizen card",
                            "passaporte": "Passport",
                            "titulo_residencia": "Residence permit",
                            "bi": "Identity card",
                            "outro": "Other"
                        }
                    },
                    "documento_numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Document no.",
                        "maxLength": 40,
                        "x-anagen-cifrado": "geral"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone",
                        "description": "With the international dialling code, for example +44 7700 900123."
                    },
                    "telefone_alt": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Alternative phone"
                    },
                    "morada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Address",
                        "maxLength": 255
                    },
                    "codigo_postal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Postcode",
                        "maxLength": 12
                    },
                    "localidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Town / city",
                        "maxLength": 100
                    },
                    "pais": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Country",
                        "description": "Two-letter country code, for example PT, GB or US.",
                        "maxLength": 2,
                        "pattern": "/^[A-Za-z]{2}$/"
                    },
                    "nacionalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Nationality",
                        "description": "Two-letter country code, for example PT, GB or US.",
                        "maxLength": 2,
                        "pattern": "/^[A-Za-z]{2}$/"
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese (Portugal)",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "profissao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Occupation",
                        "maxLength": 120
                    },
                    "medico_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Attending physician",
                        "description": "The patient’s lead physician, with access to the clinical record.",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Account manager",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source",
                        "enum": [
                            "site",
                            "pre_avaliacao",
                            "recomendacao",
                            "telefone",
                            "presencial",
                            "redes",
                            "agente",
                            "importacao",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "site": "Website",
                            "pre_avaliacao": "Online pre-assessment",
                            "recomendacao": "Referral",
                            "telefone": "Phone",
                            "presencial": "Walk-in",
                            "redes": "Social media",
                            "agente": "Virtual agent",
                            "importacao": "Import",
                            "outro": "Other"
                        }
                    },
                    "recomendado_por_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Referred by",
                        "x-anagen-recurso": "pacientes"
                    },
                    "cliente_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Patient since",
                        "description": "Start date of the relationship with the clinic (useful for imported patients)."
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "ativo",
                            "arquivado",
                            "anonimizado"
                        ],
                        "x-enum-rotulos": {
                            "ativo": "Active",
                            "arquivado": "Archived",
                            "anonimizado": "Anonymised"
                        },
                        "readOnly": true
                    },
                    "portal_ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Patient portal active",
                        "readOnly": true
                    },
                    "litigio": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "In dispute",
                        "description": "Flags a case in dispute: the record shows a notice to the whole team."
                    },
                    "notas_admin": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Administrative notes",
                        "description": "Internal notes, with no clinical content. Stored encrypted.",
                        "x-anagen-cifrado": "geral"
                    },
                    "ignorar_duplicados": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Save despite possible duplicates",
                        "description": "Tick only after confirming this is not the same person."
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-clinico": false
            },
            "Recurso_pacientes_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "First name",
                        "maxLength": 100
                    },
                    "apelidos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Surname",
                        "maxLength": 120
                    },
                    "sexo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Sex",
                        "enum": [
                            "F",
                            "M",
                            "X"
                        ],
                        "x-enum-rotulos": {
                            "F": "Female",
                            "M": "Male",
                            "X": "Other / not specified"
                        }
                    },
                    "data_nascimento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Date of birth",
                        "description": "Required to check the minimum age for eligibility."
                    },
                    "nif": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{9}$",
                        "title": "Tax number",
                        "description": "Stored encrypted. Searched by the full number.",
                        "x-anagen-cifrado": "geral"
                    },
                    "documento_tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Document type",
                        "enum": [
                            "cc",
                            "passaporte",
                            "titulo_residencia",
                            "bi",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "cc": "Portuguese citizen card",
                            "passaporte": "Passport",
                            "titulo_residencia": "Residence permit",
                            "bi": "Identity card",
                            "outro": "Other"
                        }
                    },
                    "documento_numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Document no.",
                        "maxLength": 40,
                        "x-anagen-cifrado": "geral"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone",
                        "description": "With the international dialling code, for example +44 7700 900123."
                    },
                    "telefone_alt": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Alternative phone"
                    },
                    "morada": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Address",
                        "maxLength": 255
                    },
                    "codigo_postal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Postcode",
                        "maxLength": 12
                    },
                    "localidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Town / city",
                        "maxLength": 100
                    },
                    "pais": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Country",
                        "description": "Two-letter country code, for example PT, GB or US.",
                        "maxLength": 2,
                        "pattern": "/^[A-Za-z]{2}$/"
                    },
                    "nacionalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Nationality",
                        "description": "Two-letter country code, for example PT, GB or US.",
                        "maxLength": 2,
                        "pattern": "/^[A-Za-z]{2}$/"
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese (Portugal)",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "profissao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Occupation",
                        "maxLength": 120
                    },
                    "medico_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Attending physician",
                        "description": "The patient’s lead physician, with access to the clinical record.",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Account manager",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source",
                        "enum": [
                            "site",
                            "pre_avaliacao",
                            "recomendacao",
                            "telefone",
                            "presencial",
                            "redes",
                            "agente",
                            "importacao",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "site": "Website",
                            "pre_avaliacao": "Online pre-assessment",
                            "recomendacao": "Referral",
                            "telefone": "Phone",
                            "presencial": "Walk-in",
                            "redes": "Social media",
                            "agente": "Virtual agent",
                            "importacao": "Import",
                            "outro": "Other"
                        }
                    },
                    "recomendado_por_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Referred by",
                        "x-anagen-recurso": "pacientes"
                    },
                    "cliente_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Patient since",
                        "description": "Start date of the relationship with the clinic (useful for imported patients)."
                    },
                    "litigio": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "In dispute",
                        "description": "Flags a case in dispute: the record shows a notice to the whole team."
                    },
                    "notas_admin": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Administrative notes",
                        "description": "Internal notes, with no clinical content. Stored encrypted.",
                        "x-anagen-cifrado": "geral"
                    },
                    "ignorar_duplicados": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Save despite possible duplicates",
                        "description": "Tick only after confirming this is not the same person."
                    }
                },
                "required": [
                    "nome"
                ]
            },
            "Recurso_pacientes_alertas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "alergia",
                            "medicacao",
                            "anticoagulante",
                            "condicao",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "alergia": "Allergy",
                            "medicacao": "Medication",
                            "anticoagulante": "Anticoagulant",
                            "condicao": "Medical condition",
                            "outro": "Other"
                        }
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "description": "State the substance, medicine or condition and, where relevant, the reaction or dose.",
                        "maxLength": 2000,
                        "x-anagen-cifrado": "clinico"
                    },
                    "gravidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Severity",
                        "enum": [
                            "baixa",
                            "media",
                            "alta"
                        ],
                        "x-enum-rotulos": {
                            "baixa": "Low",
                            "media": "Medium",
                            "alta": "High"
                        },
                        "default": "media"
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "validado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Validated",
                        "readOnly": true
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source",
                        "enum": [
                            "equipa",
                            "paciente",
                            "agente",
                            "formulario",
                            "importacao"
                        ],
                        "x-enum-rotulos": {
                            "equipa": "Team",
                            "paciente": "Patient",
                            "agente": "Virtual agent",
                            "formulario": "Form",
                            "importacao": "Import"
                        },
                        "readOnly": true
                    },
                    "validado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Validated by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "validado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Validated on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.clinica",
                "x-anagen-clinico": true
            },
            "Recurso_pacientes_alertas_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "alergia",
                            "medicacao",
                            "anticoagulante",
                            "condicao",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "alergia": "Allergy",
                            "medicacao": "Medication",
                            "anticoagulante": "Anticoagulant",
                            "condicao": "Medical condition",
                            "outro": "Other"
                        }
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "description": "State the substance, medicine or condition and, where relevant, the reaction or dose.",
                        "maxLength": 2000,
                        "x-anagen-cifrado": "clinico"
                    },
                    "gravidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Severity",
                        "enum": [
                            "baixa",
                            "media",
                            "alta"
                        ],
                        "x-enum-rotulos": {
                            "baixa": "Low",
                            "media": "Medium",
                            "alta": "High"
                        },
                        "default": "media"
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "paciente_id",
                    "tipo",
                    "descricao",
                    "gravidade"
                ]
            },
            "Recurso_pagamentos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "sinal",
                            "intercalar",
                            "restante",
                            "consulta",
                            "teleconsulta",
                            "tratamento",
                            "outro",
                            "adiantamento",
                            "pre_pagamento",
                            "vale",
                            "comparticipacao"
                        ],
                        "x-enum-rotulos": {
                            "sinal": "Deposit",
                            "intercalar": "Interim payment",
                            "restante": "Balance",
                            "consulta": "Consultation",
                            "teleconsulta": "Teleconsultation",
                            "tratamento": "Treatment",
                            "outro": "Other",
                            "adiantamento": "Advance payment",
                            "pre_pagamento": "Prepayment",
                            "vale": "Gift voucher",
                            "comparticipacao": "Co-payment"
                        },
                        "readOnly": true
                    },
                    "valor": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Amount",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "metodo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Method",
                        "enum": [
                            "mbway",
                            "multibanco",
                            "cartao",
                            "numerario",
                            "transferencia",
                            "ligacao",
                            "financiamento",
                            "carteira",
                            "vale"
                        ],
                        "x-enum-rotulos": {
                            "mbway": "MB WAY",
                            "multibanco": "Multibanco reference",
                            "cartao": "Card (terminal)",
                            "numerario": "Cash",
                            "transferencia": "Bank transfer",
                            "ligacao": "Payment link",
                            "financiamento": "Financing",
                            "carteira": "Wallet balance",
                            "vale": "Gift voucher"
                        },
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pendente",
                            "pago",
                            "falhado",
                            "expirado",
                            "reembolsado",
                            "cancelado"
                        ],
                        "x-enum-rotulos": {
                            "pendente": "Unpaid",
                            "pago": "Paid",
                            "falhado": "Failed",
                            "expirado": "Expired",
                            "reembolsado": "Refunded",
                            "cancelado": "Cancelled"
                        },
                        "readOnly": true
                    },
                    "vence_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Due on"
                    },
                    "pago_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Paid on",
                        "readOnly": true
                    },
                    "mb_entidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Entity",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "mb_referencia": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reference",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "mb_validade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Reference expiry",
                        "readOnly": true
                    },
                    "telefone_mascarado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "MB WAY mobile number",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "confirmacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Confirmation",
                        "enum": [
                            "api",
                            "callback",
                            "manual"
                        ],
                        "x-enum-rotulos": {
                            "api": "Provider status check",
                            "callback": "Provider notification",
                            "manual": "Manual confirmation"
                        },
                        "readOnly": true
                    },
                    "proposta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Proposal",
                        "x-anagen-recurso": "propostas",
                        "readOnly": true
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "readOnly": true
                    },
                    "caixa_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Till",
                        "x-anagen-recurso": "caixas",
                        "readOnly": true
                    },
                    "local_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Location",
                        "x-anagen-recurso": "locais",
                        "readOnly": true
                    },
                    "conta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Paying account",
                        "x-anagen-recurso": "contas_pagadoras",
                        "readOnly": true
                    },
                    "convencao_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Agreement",
                        "x-anagen-recurso": "convencoes",
                        "readOnly": true
                    },
                    "terminal_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Terminal",
                        "x-anagen-recurso": "terminais_pagamento",
                        "readOnly": true
                    },
                    "vale_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Voucher",
                        "x-anagen-recurso": "vales",
                        "readOnly": true
                    },
                    "grupo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Split procedure",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "documento_fiscal_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Tax document",
                        "x-anagen-recurso": "documentos_fiscais",
                        "readOnly": true
                    },
                    "recebido_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Received by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-clinico": false
            },
            "Recurso_pagamentos_Entrada": {
                "type": "object",
                "properties": {
                    "vence_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Due on"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    }
                }
            },
            "Recurso_parceiros": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "organizacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Organisation",
                        "maxLength": 190
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160,
                        "x-anagen-cifrado": "geral"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "medico",
                            "clinica",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "medico": "Doctor",
                            "clinica": "Clinic",
                            "outro": "Other"
                        }
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email",
                        "maxLength": 190,
                        "x-anagen-cifrado": "geral"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone",
                        "maxLength": 25,
                        "x-anagen-cifrado": "geral"
                    },
                    "cedula": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Professional licence",
                        "maxLength": 30
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pendente_email",
                            "pendente_aprovacao",
                            "ativo",
                            "suspenso",
                            "recusado"
                        ],
                        "x-enum-rotulos": {
                            "pendente_email": "Email to confirm",
                            "pendente_aprovacao": "Awaiting approval",
                            "ativo": "Active",
                            "suspenso": "Suspended",
                            "recusado": "Declined"
                        },
                        "readOnly": true
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Clinic contact person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "notas_internas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Internal notes",
                        "description": "Team only. Stored encrypted.",
                        "maxLength": 4000,
                        "x-anagen-cifrado": "geral"
                    },
                    "email_verificado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Email confirmed on",
                        "readOnly": true
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Approved on",
                        "readOnly": true
                    },
                    "ultimo_acesso_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last access",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-clinico": false
            },
            "Recurso_parceiros_Entrada": {
                "type": "object",
                "properties": {
                    "organizacao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Organisation",
                        "maxLength": 190
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160,
                        "x-anagen-cifrado": "geral"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "medico",
                            "clinica",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "medico": "Doctor",
                            "clinica": "Clinic",
                            "outro": "Other"
                        }
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email",
                        "maxLength": 190,
                        "x-anagen-cifrado": "geral"
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone",
                        "maxLength": 25,
                        "x-anagen-cifrado": "geral"
                    },
                    "cedula": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Professional licence",
                        "maxLength": 30
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Clinic contact person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "notas_internas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Internal notes",
                        "description": "Team only. Stored encrypted.",
                        "maxLength": 4000,
                        "x-anagen-cifrado": "geral"
                    }
                }
            },
            "Recurso_parceiros_encaminhamentos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Code",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "parceiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Partner",
                        "x-anagen-recurso": "parceiros",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Patient name",
                        "maxLength": 255,
                        "x-anagen-cifrado": "geral",
                        "readOnly": true
                    },
                    "contacto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Contact",
                        "maxLength": 255,
                        "x-anagen-cifrado": "geral",
                        "readOnly": true
                    },
                    "nota": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Partner note",
                        "x-anagen-cifrado": "geral",
                        "readOnly": true
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Interest",
                        "x-anagen-recurso": "procedimentos",
                        "readOnly": true
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "description": "Created automatically; correct it if it is linked to the wrong lead.",
                        "x-anagen-recurso": "leads"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "description": "Required to record the patient’s authorisation.",
                        "x-anagen-recurso": "pacientes"
                    },
                    "estado_manual": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status shown to the partner",
                        "description": "Empty = derived from the lead.",
                        "enum": [
                            "recebido",
                            "em_contacto",
                            "avaliacao",
                            "concluido",
                            "sem_seguimento"
                        ],
                        "x-enum-rotulos": {
                            "recebido": "Received",
                            "em_contacto": "In contact",
                            "avaliacao": "Being assessed",
                            "concluido": "Went ahead with the clinic",
                            "sem_seguimento": "Did not proceed"
                        }
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Origin",
                        "enum": [
                            "web",
                            "app"
                        ],
                        "x-enum-rotulos": {
                            "web": "Web",
                            "app": "App"
                        },
                        "readOnly": true
                    },
                    "declaracao_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Contact declaration on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-clinico": false
            },
            "Recurso_parceiros_encaminhamentos_Entrada": {
                "type": "object",
                "properties": {
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "description": "Created automatically; correct it if it is linked to the wrong lead.",
                        "x-anagen-recurso": "leads"
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "description": "Required to record the patient’s authorisation.",
                        "x-anagen-recurso": "pacientes"
                    },
                    "estado_manual": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status shown to the partner",
                        "description": "Empty = derived from the lead.",
                        "enum": [
                            "recebido",
                            "em_contacto",
                            "avaliacao",
                            "concluido",
                            "sem_seguimento"
                        ],
                        "x-enum-rotulos": {
                            "recebido": "Received",
                            "em_contacto": "In contact",
                            "avaliacao": "Being assessed",
                            "concluido": "Went ahead with the clinic",
                            "sem_seguimento": "Did not proceed"
                        }
                    }
                }
            },
            "Recurso_pedidos_titulares": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Request",
                        "enum": [
                            "acesso",
                            "retificacao",
                            "portabilidade",
                            "apagamento",
                            "oposicao",
                            "limitacao"
                        ],
                        "x-enum-rotulos": {
                            "acesso": "Access",
                            "retificacao": "Rectification",
                            "portabilidade": "Portability",
                            "apagamento": "Erasure",
                            "oposicao": "Objection",
                            "limitacao": "Restriction"
                        }
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "nome_requerente": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Requester’s name",
                        "description": "When the request does not come from a registered patient or contact.",
                        "maxLength": 160
                    },
                    "contacto_requerente": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Requester’s contact details",
                        "maxLength": 190,
                        "x-anagen-cifrado": "geral"
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "portal",
                            "email",
                            "presencial",
                            "telefone",
                            "carta",
                            "app"
                        ],
                        "x-enum-rotulos": {
                            "portal": "Patient portal",
                            "email": "Email",
                            "presencial": "In person",
                            "telefone": "Phone",
                            "carta": "Letter",
                            "app": "Mobile app"
                        },
                        "default": "presencial"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Request description",
                        "maxLength": 5000,
                        "x-anagen-cifrado": "geral"
                    },
                    "recebido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Received on"
                    },
                    "prazo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Deadline",
                        "readOnly": true
                    },
                    "prorrogado_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Extended until",
                        "readOnly": true
                    },
                    "prorrogacao_motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason for extension",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "recebido",
                            "em_analise",
                            "concluido",
                            "recusado"
                        ],
                        "x-enum-rotulos": {
                            "recebido": "Received",
                            "em_analise": "Under review",
                            "concluido": "Completed",
                            "recusado": "Refused"
                        },
                        "default": "recebido"
                    },
                    "identidade_verificada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Identity verified",
                        "description": "Confirm the identity before responding (ID document, authenticated portal account or details only the data subject knows)."
                    },
                    "tratado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Handled by",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "respondido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Answered on",
                        "readOnly": true
                    },
                    "resposta": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Response",
                        "maxLength": 10000,
                        "x-anagen-cifrado": "geral"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "File delivered"
                    },
                    "portal_conta_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Portal account",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_pedidos_titulares_Entrada": {
                "type": "object",
                "properties": {
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Request",
                        "enum": [
                            "acesso",
                            "retificacao",
                            "portabilidade",
                            "apagamento",
                            "oposicao",
                            "limitacao"
                        ],
                        "x-enum-rotulos": {
                            "acesso": "Access",
                            "retificacao": "Rectification",
                            "portabilidade": "Portability",
                            "apagamento": "Erasure",
                            "oposicao": "Objection",
                            "limitacao": "Restriction"
                        }
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "nome_requerente": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Requester’s name",
                        "description": "When the request does not come from a registered patient or contact.",
                        "maxLength": 160
                    },
                    "contacto_requerente": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Requester’s contact details",
                        "maxLength": 190,
                        "x-anagen-cifrado": "geral"
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "portal",
                            "email",
                            "presencial",
                            "telefone",
                            "carta",
                            "app"
                        ],
                        "x-enum-rotulos": {
                            "portal": "Patient portal",
                            "email": "Email",
                            "presencial": "In person",
                            "telefone": "Phone",
                            "carta": "Letter",
                            "app": "Mobile app"
                        },
                        "default": "presencial"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Request description",
                        "maxLength": 5000,
                        "x-anagen-cifrado": "geral"
                    },
                    "recebido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Received on"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "recebido",
                            "em_analise",
                            "concluido",
                            "recusado"
                        ],
                        "x-enum-rotulos": {
                            "recebido": "Received",
                            "em_analise": "Under review",
                            "concluido": "Completed",
                            "recusado": "Refused"
                        },
                        "default": "recebido"
                    },
                    "identidade_verificada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Identity verified",
                        "description": "Confirm the identity before responding (ID document, authenticated portal account or details only the data subject knows)."
                    },
                    "tratado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Handled by",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "resposta": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Response",
                        "maxLength": 10000,
                        "x-anagen-cifrado": "geral"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "File delivered"
                    }
                },
                "required": [
                    "tipo"
                ]
            },
            "Recurso_perfis": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 255
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Family",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255
                    },
                    "sistema": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Base profile",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-clinico": false
            },
            "Recurso_perfis_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 255
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Family",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255
                    }
                }
            },
            "Recurso_planos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "readOnly": true
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "em_revisao",
                            "aprovado",
                            "substituido"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "em_revisao": "Under review",
                            "aprovado": "Approved",
                            "substituido": "Superseded"
                        },
                        "readOnly": true
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Technique",
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "FUE": "FUE",
                            "FUT": "FUT",
                            "DHI": "DHI",
                            "outra": "Other"
                        },
                        "readOnly": true
                    },
                    "enxertos_necessarios": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Grafts required",
                        "x-unidade": "enxertos",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "sessoes": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Sessions",
                        "readOnly": true
                    },
                    "escala": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Scale",
                        "enum": [
                            "norwood",
                            "ludwig",
                            "savin",
                            "sinclair",
                            "basp",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "norwood": "Norwood",
                            "ludwig": "Ludwig",
                            "savin": "Savin",
                            "sinclair": "Sinclair",
                            "basp": "BASP",
                            "outra": "Other"
                        },
                        "readOnly": true
                    },
                    "grau": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Grade",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "capacidade_vida": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Lifetime capacity",
                        "x-unidade": "enxertos",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "capacidade_sessao": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Capacity per session",
                        "x-unidade": "enxertos",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "balanco": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Balance",
                        "x-unidade": "enxertos",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "cenario": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Scenario",
                        "enum": [
                            "conservador",
                            "provavel",
                            "agressivo"
                        ],
                        "x-enum-rotulos": {
                            "conservador": "Conservative",
                            "provavel": "Likely",
                            "agressivo": "Aggressive"
                        },
                        "readOnly": true
                    },
                    "motor_versao_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Parameter version",
                        "x-anagen-recurso": "motor_versoes",
                        "readOnly": true
                    },
                    "impressao_digital": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Digital fingerprint",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "calculado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Calculated on",
                        "readOnly": true
                    },
                    "aprovado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Approved by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Approved on",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "x-anagen-cifrado": "clinico",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.plano",
                "x-anagen-clinico": true
            },
            "Recurso_planos_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_portal_contas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Sign-in email",
                        "description": "Empty = the email in the patient record. The patient signs in with a code sent to this email.",
                        "maxLength": 190
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pendente",
                            "ativa",
                            "suspensa",
                            "eliminacao_pedida"
                        ],
                        "x-enum-rotulos": {
                            "pendente": "To confirm",
                            "ativa": "Active",
                            "suspensa": "Suspended",
                            "eliminacao_pedida": "Deletion requested"
                        },
                        "readOnly": true
                    },
                    "email_verificado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Email confirmed on",
                        "readOnly": true
                    },
                    "ultimo_acesso_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last access",
                        "readOnly": true
                    },
                    "eliminacao_pedida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Deletion requested on",
                        "readOnly": true
                    },
                    "tem_palavra_passe": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Has a password",
                        "readOnly": true
                    },
                    "canal_preferido": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Preferred channel",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "idioma_portal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Portal language",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-clinico": false
            },
            "Recurso_portal_contas_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Sign-in email",
                        "description": "Empty = the email in the patient record. The patient signs in with a code sent to this email.",
                        "maxLength": 190
                    }
                },
                "required": [
                    "paciente_id"
                ]
            },
            "Recurso_portal_pedidos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "contactos",
                            "alergias",
                            "acesso",
                            "retificacao",
                            "portabilidade",
                            "apagamento",
                            "oposicao",
                            "limitacao",
                            "eliminar_conta"
                        ],
                        "x-enum-rotulos": {
                            "contactos": "Update contacts",
                            "alergias": "Allergies",
                            "acesso": "Right of access",
                            "retificacao": "Rectification",
                            "portabilidade": "Portability",
                            "apagamento": "Erasure",
                            "oposicao": "Objection",
                            "limitacao": "Restriction",
                            "eliminar_conta": "Delete account"
                        },
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pendente",
                            "em_analise",
                            "aceite",
                            "recusado",
                            "concluido",
                            "cancelado"
                        ],
                        "x-enum-rotulos": {
                            "pendente": "Received",
                            "em_analise": "Under review",
                            "aceite": "Accepted",
                            "recusado": "Declined",
                            "concluido": "Completed",
                            "cancelado": "Cancelled"
                        },
                        "readOnly": true
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "web",
                            "app"
                        ],
                        "x-enum-rotulos": {
                            "web": "Web portal",
                            "app": "App"
                        },
                        "readOnly": true
                    },
                    "prazo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Legal deadline",
                        "readOnly": true
                    },
                    "alteracoes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Proposed changes",
                        "readOnly": true
                    },
                    "alteracoes_clinicas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reported allergies",
                        "x-anagen-permissao": "ficha.clinica",
                        "readOnly": true
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Patient description",
                        "x-anagen-cifrado": "geral",
                        "readOnly": true
                    },
                    "resposta": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reply to the patient",
                        "x-anagen-cifrado": "geral",
                        "readOnly": true
                    },
                    "decidido_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Handled by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "decidido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Handled on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.identificacao",
                "x-anagen-clinico": false
            },
            "Recurso_portal_pedidos_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_pre_avaliacoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "recebida",
                            "em_revisao",
                            "revista",
                            "respondida"
                        ],
                        "x-enum-rotulos": {
                            "recebida": "Received",
                            "em_revisao": "Under review",
                            "revista": "Reviewed",
                            "respondida": "Replied"
                        },
                        "readOnly": true
                    },
                    "procedimento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Area of interest",
                        "enum": [
                            "couro_cabeludo",
                            "barba",
                            "sobrancelhas",
                            "feminina",
                            "reparacao",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "couro_cabeludo": "Scalp",
                            "barba": "Beard",
                            "sobrancelhas": "Eyebrows",
                            "feminina": "Female hair loss",
                            "reparacao": "Correct a previous transplant",
                            "outra": "Other"
                        },
                        "readOnly": true
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt",
                            "en"
                        ],
                        "x-enum-rotulos": "English",
                        "readOnly": true
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source",
                        "enum": [
                            "site",
                            "app"
                        ],
                        "x-enum-rotulos": {
                            "site": "Website",
                            "app": "App"
                        },
                        "readOnly": true
                    },
                    "triagem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Guidance triage",
                        "enum": [
                            "elegivel_provavel",
                            "avaliar",
                            "nao_elegivel_provavel"
                        ],
                        "x-enum-rotulos": {
                            "elegivel_provavel": "Proceed to consultation",
                            "avaliar": "Review carefully",
                            "nao_elegivel_provavel": "Suggest a consultation first"
                        },
                        "x-anagen-permissao": "ficha.clinica",
                        "readOnly": true
                    },
                    "parecer": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Medical opinion",
                        "enum": [
                            "consulta",
                            "teleconsulta",
                            "mais_fotos",
                            "nao_elegivel",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "consulta": "Book an in-person consultation",
                            "teleconsulta": "Book a video consultation",
                            "mais_fotos": "Ask for more photographs",
                            "nao_elegivel": "Talk about other options",
                            "outro": "Other (team contact)"
                        },
                        "readOnly": true
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "readOnly": true
                    },
                    "revisto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Reviewed on",
                        "readOnly": true
                    },
                    "respondido_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Replied on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-clinico": false
            },
            "Recurso_pre_avaliacoes_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_procedimentos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "nome_en": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name in English",
                        "description": "Used in proposals in English.",
                        "maxLength": 160
                    },
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Code",
                        "maxLength": 30,
                        "pattern": "^[A-Za-z0-9_\\-]{1,30}$"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "consulta",
                            "cirurgia",
                            "tratamento",
                            "exame",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "consulta": "Consultation",
                            "cirurgia": "Surgery",
                            "tratamento": "Treatment",
                            "exame": "Examination",
                            "outro": "Other"
                        },
                        "default": "cirurgia"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Technique",
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "FUE": "FUE",
                            "FUT": "FUT",
                            "DHI": "Implantation with implanter pens (DHI)",
                            "outra": "Other"
                        }
                    },
                    "area": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Area",
                        "enum": [
                            "couro_cabeludo",
                            "barba",
                            "sobrancelhas",
                            "feminina",
                            "reparacao",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "couro_cabeludo": "Scalp",
                            "barba": "Beard",
                            "sobrancelhas": "Eyebrows",
                            "feminina": "Female hair",
                            "reparacao": "Repair",
                            "outra": "Other"
                        }
                    },
                    "unidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Pricing unit",
                        "enum": [
                            "enxertos",
                            "sessoes",
                            "unidade",
                            "cm2",
                            "dentes"
                        ],
                        "x-enum-rotulos": {
                            "enxertos": "Grafts",
                            "sessoes": "Sessions",
                            "unidade": "Unit",
                            "cm2": "cm²",
                            "dentes": "Teeth"
                        },
                        "default": "unidade"
                    },
                    "preco_base": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Base price",
                        "description": "Fixed price of the act, VAT included.",
                        "maximum": 1000000,
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "preco_unidade": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Price per unit",
                        "description": "Price per graft, session or unit, when there is no price list.",
                        "maximum": 100000,
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "iva_taxa": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "VAT rate (%)",
                        "description": "Medical acts with a therapeutic purpose are usually exempt; aesthetic acts may not be.",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2,
                        "default": 23
                    },
                    "iva_motivo_isencao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Exemption reason",
                        "description": "Reason code (e.g. M07 — Article 9 of the Portuguese VAT Code).",
                        "maxLength": 10,
                        "pattern": "^M[0-9]{2}$"
                    },
                    "iva_enquadramento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Tax treatment",
                        "description": "Internal note on the tax treatment of the act.",
                        "maxLength": 255
                    },
                    "iva_validado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Validated by the accountant",
                        "description": "Tick once the accountant has confirmed the rate and the reason.",
                        "default": 0
                    },
                    "iva_validado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Validated on",
                        "readOnly": true
                    },
                    "descricao_fatura": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Invoice description",
                        "description": "Usual name of the service, without diagnoses or clinical data.",
                        "maxLength": 190
                    },
                    "duracao_min": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Duration (minutes)",
                        "maximum": 1440,
                        "minimum": 0,
                        "x-unidade": "min"
                    },
                    "marcos": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "d1",
                                "s1",
                                "m1",
                                "m2",
                                "m6",
                                "m9",
                                "m12",
                                "m18"
                            ]
                        },
                        "title": "Follow-up milestones",
                        "description": "Photo and consultation points after the procedure.",
                        "x-enum-rotulos": {
                            "d1": "Day 1",
                            "s1": "Week 1",
                            "m1": "1 month",
                            "m2": "2 months",
                            "m6": "6 months",
                            "m9": "9 months",
                            "m12": "12 months",
                            "m18": "18 months"
                        }
                    },
                    "consumos": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Expected consumables",
                        "description": "Stock items used by default (for internal cost and margin)."
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 4000
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-clinico": false
            },
            "Recurso_procedimentos_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "nome_en": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name in English",
                        "description": "Used in proposals in English.",
                        "maxLength": 160
                    },
                    "codigo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Code",
                        "maxLength": 30,
                        "pattern": "^[A-Za-z0-9_\\-]{1,30}$"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "consulta",
                            "cirurgia",
                            "tratamento",
                            "exame",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "consulta": "Consultation",
                            "cirurgia": "Surgery",
                            "tratamento": "Treatment",
                            "exame": "Examination",
                            "outro": "Other"
                        },
                        "default": "cirurgia"
                    },
                    "tecnica": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Technique",
                        "enum": [
                            "FUE",
                            "FUT",
                            "DHI",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "FUE": "FUE",
                            "FUT": "FUT",
                            "DHI": "Implantation with implanter pens (DHI)",
                            "outra": "Other"
                        }
                    },
                    "area": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Area",
                        "enum": [
                            "couro_cabeludo",
                            "barba",
                            "sobrancelhas",
                            "feminina",
                            "reparacao",
                            "outra"
                        ],
                        "x-enum-rotulos": {
                            "couro_cabeludo": "Scalp",
                            "barba": "Beard",
                            "sobrancelhas": "Eyebrows",
                            "feminina": "Female hair",
                            "reparacao": "Repair",
                            "outra": "Other"
                        }
                    },
                    "unidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Pricing unit",
                        "enum": [
                            "enxertos",
                            "sessoes",
                            "unidade",
                            "cm2",
                            "dentes"
                        ],
                        "x-enum-rotulos": {
                            "enxertos": "Grafts",
                            "sessoes": "Sessions",
                            "unidade": "Unit",
                            "cm2": "cm²",
                            "dentes": "Teeth"
                        },
                        "default": "unidade"
                    },
                    "preco_base": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Base price",
                        "description": "Fixed price of the act, VAT included.",
                        "maximum": 1000000,
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "preco_unidade": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Price per unit",
                        "description": "Price per graft, session or unit, when there is no price list.",
                        "maximum": 100000,
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 2
                    },
                    "iva_taxa": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "VAT rate (%)",
                        "description": "Medical acts with a therapeutic purpose are usually exempt; aesthetic acts may not be.",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2,
                        "default": 23
                    },
                    "iva_motivo_isencao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Exemption reason",
                        "description": "Reason code (e.g. M07 — Article 9 of the Portuguese VAT Code).",
                        "maxLength": 10,
                        "pattern": "^M[0-9]{2}$"
                    },
                    "iva_enquadramento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Tax treatment",
                        "description": "Internal note on the tax treatment of the act.",
                        "maxLength": 255
                    },
                    "iva_validado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Validated by the accountant",
                        "description": "Tick once the accountant has confirmed the rate and the reason.",
                        "default": 0
                    },
                    "descricao_fatura": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Invoice description",
                        "description": "Usual name of the service, without diagnoses or clinical data.",
                        "maxLength": 190
                    },
                    "duracao_min": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Duration (minutes)",
                        "maximum": 1440,
                        "minimum": 0,
                        "x-unidade": "min"
                    },
                    "marcos": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "d1",
                                "s1",
                                "m1",
                                "m2",
                                "m6",
                                "m9",
                                "m12",
                                "m18"
                            ]
                        },
                        "title": "Follow-up milestones",
                        "description": "Photo and consultation points after the procedure.",
                        "x-enum-rotulos": {
                            "d1": "Day 1",
                            "s1": "Week 1",
                            "m1": "1 month",
                            "m2": "2 months",
                            "m6": "6 months",
                            "m9": "9 months",
                            "m12": "12 months",
                            "m18": "18 months"
                        }
                    },
                    "consumos": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Expected consumables",
                        "description": "Stock items used by default (for internal cost and margin)."
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 4000
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "tipo",
                    "unidade",
                    "iva_taxa"
                ]
            },
            "Recurso_propostas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Contact",
                        "x-anagen-recurso": "leads",
                        "readOnly": true
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "readOnly": true
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "enviada",
                            "vista",
                            "aceite",
                            "recusada",
                            "expirada"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "enviada": "Sent",
                            "vista": "Viewed",
                            "aceite": "Accepted",
                            "recusada": "Declined",
                            "expirada": "Expired"
                        },
                        "readOnly": true
                    },
                    "total": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Total",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "moeda": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Currency",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "desconto_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Discount",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "desconto_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Discount",
                        "enum": [
                            "nao_aplicavel",
                            "pendente",
                            "aprovado",
                            "recusado"
                        ],
                        "x-enum-rotulos": {
                            "nao_aplicavel": "No discount",
                            "pendente": "Awaiting decision",
                            "aprovado": "Approved",
                            "recusado": "Declined"
                        },
                        "readOnly": true
                    },
                    "validade_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until",
                        "readOnly": true
                    },
                    "enviada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Sent on",
                        "readOnly": true
                    },
                    "vista_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Viewed on",
                        "readOnly": true
                    },
                    "aceite_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Accepted on",
                        "readOnly": true
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Owner",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "plano_versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Plan version",
                        "readOnly": true
                    },
                    "parametros_versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Parameters version",
                        "readOnly": true
                    },
                    "impressao_digital": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Fingerprint",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "motivo_recusa": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason for declining",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "comercial.propostas",
                "x-anagen-clinico": false
            },
            "Recurso_propostas_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_protocolos_foto": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "marco": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Milestone",
                        "enum": [
                            "consulta",
                            "pre_operatorio",
                            "dia0",
                            "controlo",
                            "portal"
                        ],
                        "x-enum-rotulos": {
                            "consulta": "Consultation",
                            "pre_operatorio": "Pre-operative",
                            "dia0": "Day 0",
                            "controlo": "Check-up",
                            "portal": "Sent by the patient"
                        }
                    },
                    "vistas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Views",
                        "description": "List of views: [{\"chave\": \"topo\", \"nome\": \"Top\", \"instrucoes\": \"…\", \"silhueta\": \"topo\"}]. Outlines: frontal, frontal_inclinada, topo, coroa, lateral_esq, lateral_dir, dadora."
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 2000
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-clinico": false
            },
            "Recurso_protocolos_foto_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "marco": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Milestone",
                        "enum": [
                            "consulta",
                            "pre_operatorio",
                            "dia0",
                            "controlo",
                            "portal"
                        ],
                        "x-enum-rotulos": {
                            "consulta": "Consultation",
                            "pre_operatorio": "Pre-operative",
                            "dia0": "Day 0",
                            "controlo": "Check-up",
                            "portal": "Sent by the patient"
                        }
                    },
                    "vistas": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Views",
                        "description": "List of views: [{\"chave\": \"topo\", \"nome\": \"Top\", \"instrucoes\": \"…\", \"silhueta\": \"topo\"}]. Outlines: frontal, frontal_inclinada, topo, coroa, lateral_esq, lateral_dir, dadora."
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 2000
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    }
                },
                "required": [
                    "nome",
                    "marco",
                    "vistas"
                ]
            },
            "Recurso_publicos_anuncios": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "segmento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Segment",
                        "x-anagen-recurso": "segmentos"
                    },
                    "plataforma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Destination",
                        "enum": [
                            "meta",
                            "google",
                            "ficheiro"
                        ],
                        "x-enum-rotulos": {
                            "meta": "Meta — custom audience",
                            "google": "Google — customer list",
                            "ficheiro": "File only"
                        },
                        "default": "meta"
                    },
                    "destino_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Audience identifier on the platform",
                        "description": "Meta: custom audience identifier. Google: customer list identifier.",
                        "maxLength": 120
                    },
                    "automatico": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Update every day",
                        "description": "Resent once a day (people who consented join, people who objected leave).",
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "por_enviar",
                            "enviado",
                            "falhou",
                            "exportado"
                        ],
                        "x-enum-rotulos": {
                            "por_enviar": "Not sent",
                            "enviado": "Sent",
                            "falhou": "Failed",
                            "exportado": "Exported"
                        },
                        "readOnly": true
                    },
                    "enviados": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "People",
                        "readOnly": true
                    },
                    "removidos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Removed",
                        "readOnly": true
                    },
                    "excluidos": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Left out",
                        "description": "No explicit consent, on the objection list or without contact.",
                        "readOnly": true
                    },
                    "resultado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Last error",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "ultima_sincronizacao_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last time",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-clinico": false
            },
            "Recurso_publicos_anuncios_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "segmento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Segment",
                        "x-anagen-recurso": "segmentos"
                    },
                    "plataforma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Destination",
                        "enum": [
                            "meta",
                            "google",
                            "ficheiro"
                        ],
                        "x-enum-rotulos": {
                            "meta": "Meta — custom audience",
                            "google": "Google — customer list",
                            "ficheiro": "File only"
                        },
                        "default": "meta"
                    },
                    "destino_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Audience identifier on the platform",
                        "description": "Meta: custom audience identifier. Google: customer list identifier.",
                        "maxLength": 120
                    },
                    "automatico": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Update every day",
                        "description": "Resent once a day (people who consented join, people who objected leave).",
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "segmento_id",
                    "plataforma"
                ]
            },
            "Recurso_reclamacoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "reclamacao",
                            "elogio",
                            "sugestao"
                        ],
                        "x-enum-rotulos": {
                            "reclamacao": "Complaint",
                            "elogio": "Compliment",
                            "sugestao": "Suggestion"
                        },
                        "default": "reclamacao"
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "fisico",
                            "eletronico",
                            "email",
                            "portal",
                            "telefone"
                        ],
                        "x-enum-rotulos": {
                            "fisico": "Paper book",
                            "eletronico": "Electronic book",
                            "email": "Email",
                            "portal": "Patient portal",
                            "telefone": "Phone"
                        },
                        "default": "eletronico"
                    },
                    "livro_referencia": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Book reference",
                        "description": "Sheet number of the paper book or reference from the electronic Complaints Book.",
                        "maxLength": 60
                    },
                    "categoria": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Category",
                        "enum": [
                            "atendimento",
                            "tempo_espera",
                            "cuidados_clinicos",
                            "resultado",
                            "faturacao",
                            "instalacoes",
                            "privacidade",
                            "comunicacao",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "atendimento": "Customer service",
                            "tempo_espera": "Waiting time",
                            "cuidados_clinicos": "Clinical care",
                            "resultado": "Outcome",
                            "faturacao": "Invoicing",
                            "instalacoes": "Facilities",
                            "privacidade": "Privacy",
                            "comunicacao": "Communication",
                            "outro": "Other"
                        }
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "nome_reclamante": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "contacto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Contact",
                        "maxLength": 190,
                        "x-anagen-cifrado": "geral"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 10000,
                        "x-anagen-cifrado": "geral"
                    },
                    "recebida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Received on"
                    },
                    "prazo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Deadline",
                        "description": "Calculated in working days from receipt (Settings).",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "recebida",
                            "em_tratamento",
                            "respondida",
                            "encerrada"
                        ],
                        "x-enum-rotulos": {
                            "recebida": "Received",
                            "em_tratamento": "In progress",
                            "respondida": "Answered",
                            "encerrada": "Closed"
                        },
                        "readOnly": true
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person in charge",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "resposta": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Response",
                        "maxLength": 10000,
                        "x-anagen-cifrado": "geral",
                        "readOnly": true
                    },
                    "respondida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Answered on",
                        "readOnly": true
                    },
                    "exportada_ers_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Exported to the ERS on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_reclamacoes_Entrada": {
                "type": "object",
                "properties": {
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "reclamacao",
                            "elogio",
                            "sugestao"
                        ],
                        "x-enum-rotulos": {
                            "reclamacao": "Complaint",
                            "elogio": "Compliment",
                            "sugestao": "Suggestion"
                        },
                        "default": "reclamacao"
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "fisico",
                            "eletronico",
                            "email",
                            "portal",
                            "telefone"
                        ],
                        "x-enum-rotulos": {
                            "fisico": "Paper book",
                            "eletronico": "Electronic book",
                            "email": "Email",
                            "portal": "Patient portal",
                            "telefone": "Phone"
                        },
                        "default": "eletronico"
                    },
                    "livro_referencia": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Book reference",
                        "description": "Sheet number of the paper book or reference from the electronic Complaints Book.",
                        "maxLength": 60
                    },
                    "categoria": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Category",
                        "enum": [
                            "atendimento",
                            "tempo_espera",
                            "cuidados_clinicos",
                            "resultado",
                            "faturacao",
                            "instalacoes",
                            "privacidade",
                            "comunicacao",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "atendimento": "Customer service",
                            "tempo_espera": "Waiting time",
                            "cuidados_clinicos": "Clinical care",
                            "resultado": "Outcome",
                            "faturacao": "Invoicing",
                            "instalacoes": "Facilities",
                            "privacidade": "Privacy",
                            "comunicacao": "Communication",
                            "outro": "Other"
                        }
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "nome_reclamante": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "contacto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Contact",
                        "maxLength": 190,
                        "x-anagen-cifrado": "geral"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 10000,
                        "x-anagen-cifrado": "geral"
                    },
                    "recebida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Received on"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person in charge",
                        "x-anagen-recurso": "utilizadores"
                    }
                },
                "required": [
                    "tipo",
                    "canal",
                    "descricao"
                ]
            },
            "Recurso_recursos_agenda": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "sala",
                            "equipamento",
                            "interprete"
                        ],
                        "x-enum-rotulos": {
                            "sala": "Room",
                            "equipamento": "Equipment",
                            "interprete": "Interpreter"
                        },
                        "default": "sala"
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Colour",
                        "description": "Column colour in the schedule and on the surgery board."
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "en",
                            "es",
                            "fr",
                            "de",
                            "it",
                            "ar",
                            "ru",
                            "zh",
                            "nl"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German",
                            "it": "Italian",
                            "ar": "Arabic",
                            "ru": "Russian",
                            "zh": "Chinese",
                            "nl": "Dutch"
                        }
                    },
                    "capacidade": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Capacity",
                        "description": "Simultaneous appointments (1 for single rooms and equipment).",
                        "maximum": 20,
                        "minimum": 1,
                        "default": 1
                    },
                    "bloco": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Operating theatre",
                        "description": "Shown as a column on the surgery board."
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "agenda",
                "x-anagen-clinico": false
            },
            "Recurso_recursos_agenda_Entrada": {
                "type": "object",
                "properties": {
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "sala",
                            "equipamento",
                            "interprete"
                        ],
                        "x-enum-rotulos": {
                            "sala": "Room",
                            "equipamento": "Equipment",
                            "interprete": "Interpreter"
                        },
                        "default": "sala"
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Colour",
                        "description": "Column colour in the schedule and on the surgery board."
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "en",
                            "es",
                            "fr",
                            "de",
                            "it",
                            "ar",
                            "ru",
                            "zh",
                            "nl"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German",
                            "it": "Italian",
                            "ar": "Arabic",
                            "ru": "Russian",
                            "zh": "Chinese",
                            "nl": "Dutch"
                        }
                    },
                    "capacidade": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Capacity",
                        "description": "Simultaneous appointments (1 for single rooms and equipment).",
                        "maximum": 20,
                        "minimum": 1,
                        "default": 1
                    },
                    "bloco": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Operating theatre",
                        "description": "Shown as a column on the surgery board."
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "tipo",
                    "nome"
                ]
            },
            "Recurso_regras_elegibilidade": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "nivel": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Level",
                        "enum": [
                            "alerta",
                            "bloqueio"
                        ],
                        "x-enum-rotulos": {
                            "alerta": "Warning",
                            "bloqueio": "Block"
                        }
                    },
                    "mensagem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Message",
                        "description": "Text shown to the physician when the rule applies.",
                        "maxLength": 400
                    },
                    "condicao": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Condition",
                        "description": "Condition evaluated against the consultation data, for example {\"campo\": \"idade\", \"operador\": \"<\", \"valor\": 21}. Combine several with {\"todas\": […]} or {\"alguma\": […]}."
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 10000,
                        "minimum": 0,
                        "default": 100
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "rascunho",
                            "aprovada",
                            "arquivada"
                        ],
                        "x-enum-rotulos": {
                            "rascunho": "Draft",
                            "aprovada": "Approved",
                            "arquivada": "Archived"
                        },
                        "readOnly": true
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "readOnly": true
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "aprovado_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Approved by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "aprovado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Approved on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "clinico.parametros",
                "x-anagen-clinico": false
            },
            "Recurso_regras_elegibilidade_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "nivel": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Level",
                        "enum": [
                            "alerta",
                            "bloqueio"
                        ],
                        "x-enum-rotulos": {
                            "alerta": "Warning",
                            "bloqueio": "Block"
                        }
                    },
                    "mensagem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Message",
                        "description": "Text shown to the physician when the rule applies.",
                        "maxLength": 400
                    },
                    "condicao": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Condition",
                        "description": "Condition evaluated against the consultation data, for example {\"campo\": \"idade\", \"operador\": \"<\", \"valor\": 21}. Combine several with {\"todas\": […]} or {\"alguma\": […]}."
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 10000,
                        "minimum": 0,
                        "default": 100
                    }
                },
                "required": [
                    "nome",
                    "nivel",
                    "mensagem",
                    "condicao"
                ]
            },
            "Recurso_relatorios_agendados": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "indicadores": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "financeiros.faturacao",
                                "financeiros.valor_cirurgia",
                                "financeiros.margem",
                                "financeiros.comissoes",
                                "financeiros.sinais_divida",
                                "financeiros.receita_prevista",
                                "financeiros.cancelamentos",
                                "financeiros.consumiveis",
                                "financeiros.tempo_pagamento",
                                "vendas.leads_origem",
                                "vendas.primeiro_contacto",
                                "vendas.conversao",
                                "vendas.propostas",
                                "vendas.ciclo_venda",
                                "vendas.aquisicao",
                                "vendas.desempenho",
                                "vendas.email_marketing",
                                "vendas.telemarketing",
                                "vendas.motivos_perda",
                                "vendas.decisao",
                                "vendas.tempo_fases",
                                "operacionais.cirurgias",
                                "operacionais.enxertos",
                                "operacionais.planeado",
                                "operacionais.fases",
                                "operacionais.faltas",
                                "operacionais.espera",
                                "operacionais.acompanhamento",
                                "operacionais.complicacoes",
                                "operacionais.material",
                                "operacionais.coortes",
                                "operacionais.validacoes",
                                "atendimento.tempo_resposta",
                                "atendimento.confirmacao",
                                "atendimento.satisfacao",
                                "atendimento.resultado",
                                "atendimento.reclamacoes",
                                "atendimento.agente",
                                "atendimento.complementares"
                            ]
                        },
                        "title": "Indicators",
                        "x-enum-rotulos": {
                            "financeiros.faturacao": "Financeiros · Faturação",
                            "financeiros.valor_cirurgia": "Financeiros · Valor por cirurgia e por enxerto",
                            "financeiros.margem": "Financeiros · Margem por cirurgia",
                            "financeiros.comissoes": "Financeiros · Comissões e honorários",
                            "financeiros.sinais_divida": "Financeiros · Sinais e valores em dívida",
                            "financeiros.receita_prevista": "Financeiros · Receita prevista",
                            "financeiros.cancelamentos": "Financeiros · Cancelamentos e reembolsos",
                            "financeiros.consumiveis": "Financeiros · Custo de consumíveis",
                            "financeiros.tempo_pagamento": "Financeiros · Tempo até ao pagamento",
                            "vendas.leads_origem": "Vendas e marketing · Leads por origem",
                            "vendas.primeiro_contacto": "Vendas e marketing · Primeiro contacto",
                            "vendas.conversao": "Vendas e marketing · Conversão",
                            "vendas.propostas": "Vendas e marketing · Propostas",
                            "vendas.ciclo_venda": "Vendas e marketing · Ciclo de venda",
                            "vendas.aquisicao": "Vendas e marketing · Custo de aquisição e retorno",
                            "vendas.desempenho": "Vendas e marketing · Desempenho por pessoa",
                            "vendas.email_marketing": "Vendas e marketing · Email marketing",
                            "vendas.telemarketing": "Vendas e marketing · Telemarketing",
                            "vendas.motivos_perda": "Vendas e marketing · Motivos de perda",
                            "vendas.decisao": "Vendas e marketing · Painel de decisão",
                            "vendas.tempo_fases": "Vendas e marketing · Tempo em cada fase",
                            "operacionais.cirurgias": "Operacionais e produção · Cirurgias e ocupação",
                            "operacionais.enxertos": "Operacionais e produção · Enxertos",
                            "operacionais.planeado": "Operacionais e produção · Planeado face a realizado",
                            "operacionais.fases": "Operacionais e produção · Fases e equipa",
                            "operacionais.faltas": "Operacionais e produção · Faltas e cancelamentos",
                            "operacionais.espera": "Operacionais e produção · Tempos de espera",
                            "operacionais.acompanhamento": "Operacionais e produção · Cumprimento do acompanhamento",
                            "operacionais.complicacoes": "Operacionais e produção · Complicações e ocorrências",
                            "operacionais.material": "Operacionais e produção · Material e stock",
                            "operacionais.coortes": "Operacionais e produção · Coortes de resultados",
                            "operacionais.validacoes": "Operacionais e produção · Validações em atraso",
                            "atendimento.tempo_resposta": "Atendimento e clientes · Tempo de resposta",
                            "atendimento.confirmacao": "Atendimento e clientes · Confirmação de presença",
                            "atendimento.satisfacao": "Atendimento e clientes · Satisfação e recomendação",
                            "atendimento.resultado": "Atendimento e clientes · Resultado percebido",
                            "atendimento.reclamacoes": "Atendimento e clientes · Reclamações",
                            "atendimento.agente": "Atendimento e clientes · Assistente de voz",
                            "atendimento.complementares": "Atendimento e clientes · Complementares e recomendação"
                        }
                    },
                    "periodicidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Frequency",
                        "enum": [
                            "diaria",
                            "semanal",
                            "mensal"
                        ],
                        "x-enum-rotulos": {
                            "diaria": "Daily",
                            "semanal": "Weekly (Monday)",
                            "mensal": "Monthly (1st)"
                        },
                        "default": "semanal"
                    },
                    "hora_envio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "Sending time",
                        "default": "08:00"
                    },
                    "destinatarios": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Recipients",
                        "description": "Each person only receives the indicators they are allowed to view.",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "filtros": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Filters",
                        "description": "Optional, in JSON. E.g. {\"origem\": \"meta\", \"procedimento_id\": 3}."
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "proximo_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Next delivery",
                        "readOnly": true
                    },
                    "ultimo_envio_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last delivery",
                        "readOnly": true
                    },
                    "ultimo_resultado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Result of last delivery",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-clinico": false
            },
            "Recurso_relatorios_agendados_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "indicadores": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "financeiros.faturacao",
                                "financeiros.valor_cirurgia",
                                "financeiros.margem",
                                "financeiros.comissoes",
                                "financeiros.sinais_divida",
                                "financeiros.receita_prevista",
                                "financeiros.cancelamentos",
                                "financeiros.consumiveis",
                                "financeiros.tempo_pagamento",
                                "vendas.leads_origem",
                                "vendas.primeiro_contacto",
                                "vendas.conversao",
                                "vendas.propostas",
                                "vendas.ciclo_venda",
                                "vendas.aquisicao",
                                "vendas.desempenho",
                                "vendas.email_marketing",
                                "vendas.telemarketing",
                                "vendas.motivos_perda",
                                "vendas.decisao",
                                "vendas.tempo_fases",
                                "operacionais.cirurgias",
                                "operacionais.enxertos",
                                "operacionais.planeado",
                                "operacionais.fases",
                                "operacionais.faltas",
                                "operacionais.espera",
                                "operacionais.acompanhamento",
                                "operacionais.complicacoes",
                                "operacionais.material",
                                "operacionais.coortes",
                                "operacionais.validacoes",
                                "atendimento.tempo_resposta",
                                "atendimento.confirmacao",
                                "atendimento.satisfacao",
                                "atendimento.resultado",
                                "atendimento.reclamacoes",
                                "atendimento.agente",
                                "atendimento.complementares"
                            ]
                        },
                        "title": "Indicators",
                        "x-enum-rotulos": {
                            "financeiros.faturacao": "Financeiros · Faturação",
                            "financeiros.valor_cirurgia": "Financeiros · Valor por cirurgia e por enxerto",
                            "financeiros.margem": "Financeiros · Margem por cirurgia",
                            "financeiros.comissoes": "Financeiros · Comissões e honorários",
                            "financeiros.sinais_divida": "Financeiros · Sinais e valores em dívida",
                            "financeiros.receita_prevista": "Financeiros · Receita prevista",
                            "financeiros.cancelamentos": "Financeiros · Cancelamentos e reembolsos",
                            "financeiros.consumiveis": "Financeiros · Custo de consumíveis",
                            "financeiros.tempo_pagamento": "Financeiros · Tempo até ao pagamento",
                            "vendas.leads_origem": "Vendas e marketing · Leads por origem",
                            "vendas.primeiro_contacto": "Vendas e marketing · Primeiro contacto",
                            "vendas.conversao": "Vendas e marketing · Conversão",
                            "vendas.propostas": "Vendas e marketing · Propostas",
                            "vendas.ciclo_venda": "Vendas e marketing · Ciclo de venda",
                            "vendas.aquisicao": "Vendas e marketing · Custo de aquisição e retorno",
                            "vendas.desempenho": "Vendas e marketing · Desempenho por pessoa",
                            "vendas.email_marketing": "Vendas e marketing · Email marketing",
                            "vendas.telemarketing": "Vendas e marketing · Telemarketing",
                            "vendas.motivos_perda": "Vendas e marketing · Motivos de perda",
                            "vendas.decisao": "Vendas e marketing · Painel de decisão",
                            "vendas.tempo_fases": "Vendas e marketing · Tempo em cada fase",
                            "operacionais.cirurgias": "Operacionais e produção · Cirurgias e ocupação",
                            "operacionais.enxertos": "Operacionais e produção · Enxertos",
                            "operacionais.planeado": "Operacionais e produção · Planeado face a realizado",
                            "operacionais.fases": "Operacionais e produção · Fases e equipa",
                            "operacionais.faltas": "Operacionais e produção · Faltas e cancelamentos",
                            "operacionais.espera": "Operacionais e produção · Tempos de espera",
                            "operacionais.acompanhamento": "Operacionais e produção · Cumprimento do acompanhamento",
                            "operacionais.complicacoes": "Operacionais e produção · Complicações e ocorrências",
                            "operacionais.material": "Operacionais e produção · Material e stock",
                            "operacionais.coortes": "Operacionais e produção · Coortes de resultados",
                            "operacionais.validacoes": "Operacionais e produção · Validações em atraso",
                            "atendimento.tempo_resposta": "Atendimento e clientes · Tempo de resposta",
                            "atendimento.confirmacao": "Atendimento e clientes · Confirmação de presença",
                            "atendimento.satisfacao": "Atendimento e clientes · Satisfação e recomendação",
                            "atendimento.resultado": "Atendimento e clientes · Resultado percebido",
                            "atendimento.reclamacoes": "Atendimento e clientes · Reclamações",
                            "atendimento.agente": "Atendimento e clientes · Assistente de voz",
                            "atendimento.complementares": "Atendimento e clientes · Complementares e recomendação"
                        }
                    },
                    "periodicidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Frequency",
                        "enum": [
                            "diaria",
                            "semanal",
                            "mensal"
                        ],
                        "x-enum-rotulos": {
                            "diaria": "Daily",
                            "semanal": "Weekly (Monday)",
                            "mensal": "Monthly (1st)"
                        },
                        "default": "semanal"
                    },
                    "hora_envio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\d{2}:\\d{2}$",
                        "title": "Sending time",
                        "default": "08:00"
                    },
                    "destinatarios": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Recipients",
                        "description": "Each person only receives the indicators they are allowed to view.",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "filtros": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Filters",
                        "description": "Optional, in JSON. E.g. {\"origem\": \"meta\", \"procedimento_id\": 3}."
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "indicadores",
                    "destinatarios"
                ]
            },
            "Recurso_respostas_rapidas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 120
                    },
                    "atalho": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Shortcut",
                        "description": "E.g. /horario — type it in the message to insert the text.",
                        "maxLength": 30
                    },
                    "corpo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text",
                        "description": "No promotions or clinical details.",
                        "maxLength": 4000
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "description": "Empty: all channels.",
                        "enum": [
                            "portal",
                            "whatsapp",
                            "instagram",
                            "messenger",
                            "email",
                            "chat_site",
                            "sms"
                        ],
                        "x-enum-rotulos": {
                            "portal": "Portal",
                            "whatsapp": "WhatsApp",
                            "instagram": "Instagram",
                            "messenger": "Messenger",
                            "email": "Email",
                            "chat_site": "Website chat",
                            "sms": "SMS"
                        }
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.atendimento",
                "x-anagen-clinico": false
            },
            "Recurso_respostas_rapidas_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 120
                    },
                    "atalho": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Shortcut",
                        "description": "E.g. /horario — type it in the message to insert the text.",
                        "maxLength": 30
                    },
                    "corpo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Text",
                        "description": "No promotions or clinical details.",
                        "maxLength": 4000
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "description": "Empty: all channels.",
                        "enum": [
                            "portal",
                            "whatsapp",
                            "instagram",
                            "messenger",
                            "email",
                            "chat_site",
                            "sms"
                        ],
                        "x-enum-rotulos": {
                            "portal": "Portal",
                            "whatsapp": "WhatsApp",
                            "instagram": "Instagram",
                            "messenger": "Messenger",
                            "email": "Email",
                            "chat_site": "Website chat",
                            "sms": "SMS"
                        }
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    }
                },
                "required": [
                    "titulo",
                    "corpo"
                ]
            },
            "Recurso_reunioes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "End"
                    },
                    "participantes": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Participants",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "canal_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Channel"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Agenda",
                        "maxLength": 4000
                    },
                    "criar_sala": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Create video room",
                        "description": "Uses the video service configured by the clinic.",
                        "default": 1
                    },
                    "sala_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "title": "Room address",
                        "description": "Filled in automatically; you can also paste an https:// address.",
                        "maxLength": 500
                    },
                    "gravada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Record the meeting",
                        "default": 0
                    },
                    "transcrita": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Transcribe the meeting",
                        "default": 0
                    },
                    "aviso_confirmado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "I confirm that all participants are notified of the recording/transcription",
                        "description": "Required to record or transcribe. The notice is included in the notification and in the channel."
                    },
                    "aviso_gravacao_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Recording notice given on",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "agendada",
                            "em_curso",
                            "terminada",
                            "cancelada"
                        ],
                        "x-enum-rotulos": {
                            "agendada": "Scheduled",
                            "em_curso": "In progress",
                            "terminada": "Ended",
                            "cancelada": "Cancelled"
                        },
                        "readOnly": true,
                        "default": "agendada"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "description": "Internal notes, stored encrypted. Do not enter clinical data.",
                        "maxLength": 20000,
                        "x-anagen-cifrado": "geral"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "equipa.chat",
                "x-anagen-clinico": false
            },
            "Recurso_reunioes_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 200
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "End"
                    },
                    "participantes": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "title": "Participants",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "canal_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Channel"
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Agenda",
                        "maxLength": 4000
                    },
                    "criar_sala": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Create video room",
                        "description": "Uses the video service configured by the clinic.",
                        "default": 1
                    },
                    "sala_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "title": "Room address",
                        "description": "Filled in automatically; you can also paste an https:// address.",
                        "maxLength": 500
                    },
                    "gravada": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Record the meeting",
                        "default": 0
                    },
                    "transcrita": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Transcribe the meeting",
                        "default": 0
                    },
                    "aviso_confirmado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "I confirm that all participants are notified of the recording/transcription",
                        "description": "Required to record or transcribe. The notice is included in the notification and in the channel."
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "description": "Internal notes, stored encrypted. Do not enter clinical data.",
                        "maxLength": 20000,
                        "x-anagen-cifrado": "geral"
                    }
                },
                "required": [
                    "titulo",
                    "inicio"
                ]
            },
            "Recurso_revisoes_acessos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "periodo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Quarter",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "em_curso",
                            "concluida"
                        ],
                        "x-enum-rotulos": {
                            "em_curso": "In progress",
                            "concluida": "Completed"
                        },
                        "readOnly": true
                    },
                    "iniciada_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Started on",
                        "readOnly": true
                    },
                    "utilizadores_n": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "People",
                        "x-unidade": "pessoas",
                        "readOnly": true
                    },
                    "sensiveis_n": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "With clinical access",
                        "x-unidade": "pessoas",
                        "readOnly": true
                    },
                    "revisto_por": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Completed by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "revisto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Completed on",
                        "readOnly": true
                    },
                    "alteracoes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Changes made",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-clinico": false
            },
            "Recurso_revisoes_acessos_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_segmentos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "email",
                            "sms",
                            "whatsapp"
                        ],
                        "x-enum-rotulos": {
                            "email": "Email",
                            "sms": "SMS",
                            "whatsapp": "WhatsApp"
                        },
                        "default": "email"
                    },
                    "regras": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Rules",
                        "description": "{\"publico\": \"leads|pacientes|ambos\", \"condicoes\": [{\"campo\": \"fase_id|origem|idioma|decisao|pontuacao_min|criado_desde|criado_ate|cliente|ultima_visita_dias_min|ultima_visita_dias_max|procedimento_id\", \"valor\": …}]}"
                    },
                    "usa_dados_clinicos": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Uses clinical data",
                        "description": "Segmenting by procedure requires explicit consent from each contact.",
                        "readOnly": true
                    },
                    "contagem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Can receive",
                        "readOnly": true
                    },
                    "contagem_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Counted at",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "marketing",
                "x-anagen-clinico": false
            },
            "Recurso_segmentos_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "email",
                            "sms",
                            "whatsapp"
                        ],
                        "x-enum-rotulos": {
                            "email": "Email",
                            "sms": "SMS",
                            "whatsapp": "WhatsApp"
                        },
                        "default": "email"
                    },
                    "regras": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Rules",
                        "description": "{\"publico\": \"leads|pacientes|ambos\", \"condicoes\": [{\"campo\": \"fase_id|origem|idioma|decisao|pontuacao_min|criado_desde|criado_ate|cliente|ultima_visita_dias_min|ultima_visita_dias_max|procedimento_id\", \"valor\": …}]}"
                    }
                },
                "required": [
                    "nome",
                    "regras"
                ]
            },
            "Recurso_sequencias": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "gatilho": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Starts when",
                        "enum": [
                            "lead_criado",
                            "fase",
                            "manual"
                        ],
                        "x-enum-rotulos": {
                            "lead_criado": "Lead created",
                            "fase": "Entering a stage",
                            "manual": "Manual"
                        },
                        "default": "lead_criado"
                    },
                    "fase_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Stage",
                        "x-anagen-recurso": "funil_fases"
                    },
                    "passos": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Steps",
                        "description": "List of {\"dia\", \"canal\": email|sms|whatsapp|tarefa, \"finalidade\": servico|marketing, \"assunto\", \"corpo\", \"tarefa\"}. {nome} and {clinica} are replaced."
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "parar_ao_responder": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Stop when the contact replies",
                        "default": 1
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.leads",
                "x-anagen-clinico": false
            },
            "Recurso_sequencias_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "gatilho": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Starts when",
                        "enum": [
                            "lead_criado",
                            "fase",
                            "manual"
                        ],
                        "x-enum-rotulos": {
                            "lead_criado": "Lead created",
                            "fase": "Entering a stage",
                            "manual": "Manual"
                        },
                        "default": "lead_criado"
                    },
                    "fase_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Stage",
                        "x-anagen-recurso": "funil_fases"
                    },
                    "passos": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Steps",
                        "description": "List of {\"dia\", \"canal\": email|sms|whatsapp|tarefa, \"finalidade\": servico|marketing, \"assunto\", \"corpo\", \"tarefa\"}. {nome} and {clinica} are replaced."
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "parar_ao_responder": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Stop when the contact replies",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "gatilho",
                    "passos"
                ]
            },
            "Recurso_stock_movimentos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "artigo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Item",
                        "x-anagen-recurso": "artigos"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "entrada",
                            "saida",
                            "ajuste",
                            "consumo",
                            "devolucao"
                        ],
                        "x-enum-rotulos": {
                            "entrada": "Stock in",
                            "saida": "Stock out",
                            "ajuste": "Adjustment",
                            "consumo": "Surgical consumption",
                            "devolucao": "Return"
                        }
                    },
                    "quantidade": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Quantity",
                        "description": "Positive for stock in; for adjustments, negative to remove.",
                        "x-casas": 3
                    },
                    "lote": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Batch",
                        "maxLength": 60
                    },
                    "validade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Expiry date"
                    },
                    "custo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Unit cost",
                        "description": "For stock in, updates the item’s average cost.",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 4
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Surgery",
                        "readOnly": true
                    },
                    "encomenda_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "x-anagen-recurso": "encomendas",
                        "readOnly": true
                    },
                    "saldo_apos": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Balance after",
                        "x-casas": 3,
                        "readOnly": true
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Recorded by",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 500
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "stock",
                "x-anagen-clinico": false
            },
            "Recurso_stock_movimentos_Entrada": {
                "type": "object",
                "properties": {
                    "artigo_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Item",
                        "x-anagen-recurso": "artigos"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "entrada",
                            "saida",
                            "ajuste",
                            "consumo",
                            "devolucao"
                        ],
                        "x-enum-rotulos": {
                            "entrada": "Stock in",
                            "saida": "Stock out",
                            "ajuste": "Adjustment",
                            "consumo": "Surgical consumption",
                            "devolucao": "Return"
                        }
                    },
                    "quantidade": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Quantity",
                        "description": "Positive for stock in; for adjustments, negative to remove.",
                        "x-casas": 3
                    },
                    "lote": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Batch",
                        "maxLength": 60
                    },
                    "validade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Expiry date"
                    },
                    "custo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Unit cost",
                        "description": "For stock in, updates the item’s average cost.",
                        "minimum": 0,
                        "x-moeda": "EUR",
                        "x-casas": 4
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 500
                    }
                },
                "required": [
                    "artigo_id",
                    "tipo",
                    "quantidade"
                ]
            },
            "Recurso_subcontratantes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purpose",
                        "maxLength": 500
                    },
                    "pais": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Country",
                        "maxLength": 60
                    },
                    "categorias_dados": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "identificacao",
                                "contacto",
                                "saude",
                                "imagens",
                                "modelos_3d",
                                "gravacoes",
                                "financeiros",
                                "comportamento_site",
                                "profissionais"
                            ]
                        },
                        "title": "Data categories",
                        "x-enum-rotulos": {
                            "identificacao": "Identification",
                            "contacto": "Contact details",
                            "saude": "Health data",
                            "imagens": "Photographs and images",
                            "modelos_3d": "3D models",
                            "gravacoes": "Voice and video recordings",
                            "financeiros": "Financial data",
                            "comportamento_site": "Website browsing",
                            "profissionais": "Professionals’ data"
                        }
                    },
                    "contrato_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Contract until"
                    },
                    "dpa_assinado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Processing agreement signed",
                        "description": "Contract with the clauses of GDPR Art. 28."
                    },
                    "sistema_ia": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Artificial intelligence system"
                    },
                    "sem_treino": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "No-training guarantee",
                        "description": "The provider contractually guarantees that it does not use the clinic’s data to train models.",
                        "default": 1
                    },
                    "transferencia_internacional": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Transfer outside the EEA"
                    },
                    "garantias": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Safeguards",
                        "description": "Certifications, technical and organisational measures, data location.",
                        "maxLength": 255
                    },
                    "contacto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Contact",
                        "maxLength": 190
                    },
                    "website": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "title": "Website"
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "revisao_juridica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Reviewed by the DPO/legal team",
                        "description": "Tick once the data protection officer or the legal team has reviewed the text. Texts supplied with the system arrive unreviewed."
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 5000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_subcontratantes_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Purpose",
                        "maxLength": 500
                    },
                    "pais": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Country",
                        "maxLength": 60
                    },
                    "categorias_dados": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "identificacao",
                                "contacto",
                                "saude",
                                "imagens",
                                "modelos_3d",
                                "gravacoes",
                                "financeiros",
                                "comportamento_site",
                                "profissionais"
                            ]
                        },
                        "title": "Data categories",
                        "x-enum-rotulos": {
                            "identificacao": "Identification",
                            "contacto": "Contact details",
                            "saude": "Health data",
                            "imagens": "Photographs and images",
                            "modelos_3d": "3D models",
                            "gravacoes": "Voice and video recordings",
                            "financeiros": "Financial data",
                            "comportamento_site": "Website browsing",
                            "profissionais": "Professionals’ data"
                        }
                    },
                    "contrato_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Contract until"
                    },
                    "dpa_assinado": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Processing agreement signed",
                        "description": "Contract with the clauses of GDPR Art. 28."
                    },
                    "sistema_ia": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Artificial intelligence system"
                    },
                    "sem_treino": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "No-training guarantee",
                        "description": "The provider contractually guarantees that it does not use the clinic’s data to train models.",
                        "default": 1
                    },
                    "transferencia_internacional": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Transfer outside the EEA"
                    },
                    "garantias": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Safeguards",
                        "description": "Certifications, technical and organisational measures, data location.",
                        "maxLength": 255
                    },
                    "contacto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Contact",
                        "maxLength": 190
                    },
                    "website": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "title": "Website"
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "revisao_juridica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Reviewed by the DPO/legal team",
                        "description": "Tick once the data protection officer or the legal team has reviewed the text. Texts supplied with the system arrive unreviewed."
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 5000
                    }
                },
                "required": [
                    "nome",
                    "finalidade"
                ]
            },
            "Recurso_supressoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "email",
                            "sms",
                            "whatsapp",
                            "telefone",
                            "todos"
                        ],
                        "x-enum-rotulos": {
                            "email": "Email",
                            "sms": "SMS",
                            "whatsapp": "WhatsApp",
                            "telefone": "Phone",
                            "todos": "All channels"
                        },
                        "default": "todos"
                    },
                    "valor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Contact",
                        "description": "Email or phone. Stored irreversibly (fingerprint only) and shown masked.",
                        "maxLength": 190
                    },
                    "valor_mascarado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Contact",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason",
                        "maxLength": 255
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "conformidade",
                "x-anagen-clinico": false
            },
            "Recurso_supressoes_Entrada": {
                "type": "object",
                "properties": {
                    "canal": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Channel",
                        "enum": [
                            "email",
                            "sms",
                            "whatsapp",
                            "telefone",
                            "todos"
                        ],
                        "x-enum-rotulos": {
                            "email": "Email",
                            "sms": "SMS",
                            "whatsapp": "WhatsApp",
                            "telefone": "Phone",
                            "todos": "All channels"
                        },
                        "default": "todos"
                    },
                    "valor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Contact",
                        "description": "Email or phone. Stored irreversibly (fingerprint only) and shown masked.",
                        "maxLength": 190
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason",
                        "maxLength": 255
                    }
                },
                "required": [
                    "canal",
                    "valor"
                ]
            },
            "Recurso_tabelas_precos": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "por_enxerto",
                            "escalao",
                            "sessao",
                            "pacote"
                        ],
                        "x-enum-rotulos": {
                            "por_enxerto": "Price per graft",
                            "escalao": "Graft tiers",
                            "sessao": "Price per session",
                            "pacote": "Packages"
                        },
                        "default": "escalao"
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "description": "Leave blank to use with any procedure.",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "local_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Location",
                        "description": "Empty = all locations. A location’s table takes priority over the general one in that location’s proposals.",
                        "x-anagen-recurso": "locais"
                    },
                    "regras": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Rules",
                        "description": "Prices, tiers, zones, packages and extras."
                    },
                    "iva_taxa": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "VAT rate (%)",
                        "description": "Leave blank to use the procedure’s rate.",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "moeda": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Currency",
                        "enum": [
                            "EUR"
                        ],
                        "x-enum-rotulos": {
                            "EUR": "EUR"
                        },
                        "readOnly": true,
                        "default": "EUR"
                    },
                    "valida_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valida_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-clinico": false
            },
            "Recurso_tabelas_precos_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "por_enxerto",
                            "escalao",
                            "sessao",
                            "pacote"
                        ],
                        "x-enum-rotulos": {
                            "por_enxerto": "Price per graft",
                            "escalao": "Graft tiers",
                            "sessao": "Price per session",
                            "pacote": "Packages"
                        },
                        "default": "escalao"
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "description": "Leave blank to use with any procedure.",
                        "x-anagen-recurso": "procedimentos"
                    },
                    "local_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Location",
                        "description": "Empty = all locations. A location’s table takes priority over the general one in that location’s proposals.",
                        "x-anagen-recurso": "locais"
                    },
                    "regras": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Rules",
                        "description": "Prices, tiers, zones, packages and extras."
                    },
                    "iva_taxa": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "VAT rate (%)",
                        "description": "Leave blank to use the procedure’s rate.",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "valida_desde": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid from"
                    },
                    "valida_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until"
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 4000
                    }
                },
                "required": [
                    "nome",
                    "tipo",
                    "regras"
                ]
            },
            "Recurso_tarefas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 255
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "description": "Context for whoever will carry it out. Do not enter clinical data here.",
                        "maxLength": 5000
                    },
                    "prioridade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Priority",
                        "enum": [
                            "baixa",
                            "normal",
                            "alta",
                            "urgente"
                        ],
                        "x-enum-rotulos": {
                            "baixa": "Low",
                            "normal": "Normal",
                            "alta": "High",
                            "urgente": "Urgent"
                        },
                        "default": "normal"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "aberta",
                            "em_curso",
                            "concluida",
                            "cancelada"
                        ],
                        "x-enum-rotulos": {
                            "aberta": "Open",
                            "em_curso": "In progress",
                            "concluida": "Completed",
                            "cancelada": "Cancelled"
                        },
                        "default": "aberta"
                    },
                    "prazo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Due date"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Owner",
                        "description": "With no owner or department, the task stays with whoever creates it.",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "x-anagen-permissao": "ficha.identificacao"
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "x-anagen-recurso": "leads",
                        "x-anagen-permissao": "crm.leads"
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Surgery",
                        "x-anagen-recurso": "cirurgias",
                        "x-anagen-permissao": "bloco.mapa"
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Source",
                        "enum": [
                            "manual",
                            "automatica",
                            "mensagem",
                            "agente"
                        ],
                        "x-enum-rotulos": {
                            "manual": "Manual",
                            "automatica": "Automatic",
                            "mensagem": "From chat",
                            "agente": "From the assistant"
                        },
                        "readOnly": true
                    },
                    "concluida_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Completed on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "equipa.tarefas",
                "x-anagen-clinico": false
            },
            "Recurso_tarefas_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 255
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "description": "Context for whoever will carry it out. Do not enter clinical data here.",
                        "maxLength": 5000
                    },
                    "prioridade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Priority",
                        "enum": [
                            "baixa",
                            "normal",
                            "alta",
                            "urgente"
                        ],
                        "x-enum-rotulos": {
                            "baixa": "Low",
                            "normal": "Normal",
                            "alta": "High",
                            "urgente": "Urgent"
                        },
                        "default": "normal"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "aberta",
                            "em_curso",
                            "concluida",
                            "cancelada"
                        ],
                        "x-enum-rotulos": {
                            "aberta": "Open",
                            "em_curso": "In progress",
                            "concluida": "Completed",
                            "cancelada": "Cancelled"
                        },
                        "default": "aberta"
                    },
                    "prazo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Due date"
                    },
                    "responsavel_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Owner",
                        "description": "With no owner or department, the task stays with whoever creates it.",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "x-anagen-permissao": "ficha.identificacao"
                    },
                    "lead_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Lead",
                        "x-anagen-recurso": "leads",
                        "x-anagen-permissao": "crm.leads"
                    },
                    "cirurgia_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Surgery",
                        "x-anagen-recurso": "cirurgias",
                        "x-anagen-permissao": "bloco.mapa"
                    }
                },
                "required": [
                    "titulo"
                ]
            },
            "Recurso_teleconsultas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "medico_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Doctor",
                        "x-anagen-recurso": "utilizadores",
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "agendada",
                            "sala_espera",
                            "em_curso",
                            "terminada",
                            "fechada"
                        ],
                        "x-enum-rotulos": {
                            "agendada": "Scheduled",
                            "sala_espera": "In the waiting room",
                            "em_curso": "In progress",
                            "terminada": "Ended",
                            "fechada": "Closed"
                        },
                        "readOnly": true
                    },
                    "inicio_real": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Start",
                        "readOnly": true
                    },
                    "fim_real": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "End",
                        "readOnly": true
                    },
                    "relatorio_fechado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Report closed on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "teleconsulta",
                "x-anagen-clinico": true
            },
            "Recurso_teleconsultas_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_telefonia_extensoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "departamento",
                            "pessoa"
                        ],
                        "x-enum-rotulos": {
                            "departamento": "Department",
                            "pessoa": "Person"
                        },
                        "default": "departamento"
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "enum": [
                            "rececao",
                            "comercial",
                            "enfermagem",
                            "medico",
                            "tecnico",
                            "administracao"
                        ],
                        "x-enum-rotulos": {
                            "rececao": "Front desk",
                            "comercial": "Sales",
                            "enfermagem": "Nursing",
                            "medico": "Doctor",
                            "tecnico": "Technician",
                            "administracao": "Administration"
                        }
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "extensao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Extension or number",
                        "description": "As the phone system knows it (e.g. 201).",
                        "maxLength": 40
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-clinico": false
            },
            "Recurso_telefonia_extensoes_Entrada": {
                "type": "object",
                "properties": {
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Type",
                        "enum": [
                            "departamento",
                            "pessoa"
                        ],
                        "x-enum-rotulos": {
                            "departamento": "Department",
                            "pessoa": "Person"
                        },
                        "default": "departamento"
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "enum": [
                            "rececao",
                            "comercial",
                            "enfermagem",
                            "medico",
                            "tecnico",
                            "administracao"
                        ],
                        "x-enum-rotulos": {
                            "rececao": "Front desk",
                            "comercial": "Sales",
                            "enfermagem": "Nursing",
                            "medico": "Doctor",
                            "tecnico": "Technician",
                            "administracao": "Administration"
                        }
                    },
                    "utilizador_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Person",
                        "x-anagen-recurso": "utilizadores"
                    },
                    "extensao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Extension or number",
                        "description": "As the phone system knows it (e.g. 201).",
                        "maxLength": 40
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": true
                    }
                },
                "required": [
                    "tipo",
                    "extensao"
                ]
            },
            "Recurso_telefonia_numeros": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number"
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Lead source",
                        "enum": [
                            "site",
                            "pre_avaliacao",
                            "meta",
                            "google",
                            "whatsapp",
                            "instagram",
                            "messenger",
                            "telefone",
                            "presencial",
                            "recomendacao",
                            "agente_voz",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "site": "Website",
                            "pre_avaliacao": "Pre-assessment",
                            "meta": "Meta (ads)",
                            "google": "Google (ads)",
                            "whatsapp": "WhatsApp",
                            "instagram": "Instagram",
                            "messenger": "Messenger",
                            "telefone": "Phone",
                            "presencial": "Walk-in",
                            "recomendacao": "Referral",
                            "agente_voz": "Voice agent",
                            "outro": "Other"
                        },
                        "default": "telefone"
                    },
                    "campanha": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Campaign",
                        "maxLength": 120
                    },
                    "utm_source": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_source",
                        "maxLength": 120
                    },
                    "utm_medium": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_medium",
                        "maxLength": 120
                    },
                    "utm_campaign": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_campaign",
                        "maxLength": 120
                    },
                    "menu_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Voice menu",
                        "description": "Empty: the main menu answers.",
                        "x-anagen-recurso": "voz_menus"
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-clinico": false
            },
            "Recurso_telefonia_numeros_Entrada": {
                "type": "object",
                "properties": {
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number"
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "origem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Lead source",
                        "enum": [
                            "site",
                            "pre_avaliacao",
                            "meta",
                            "google",
                            "whatsapp",
                            "instagram",
                            "messenger",
                            "telefone",
                            "presencial",
                            "recomendacao",
                            "agente_voz",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "site": "Website",
                            "pre_avaliacao": "Pre-assessment",
                            "meta": "Meta (ads)",
                            "google": "Google (ads)",
                            "whatsapp": "WhatsApp",
                            "instagram": "Instagram",
                            "messenger": "Messenger",
                            "telefone": "Phone",
                            "presencial": "Walk-in",
                            "recomendacao": "Referral",
                            "agente_voz": "Voice agent",
                            "outro": "Other"
                        },
                        "default": "telefone"
                    },
                    "campanha": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Campaign",
                        "maxLength": 120
                    },
                    "utm_source": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_source",
                        "maxLength": 120
                    },
                    "utm_medium": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_medium",
                        "maxLength": 120
                    },
                    "utm_campaign": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "utm_campaign",
                        "maxLength": 120
                    },
                    "menu_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Voice menu",
                        "description": "Empty: the main menu answers.",
                        "x-anagen-recurso": "voz_menus"
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": true
                    }
                },
                "required": [
                    "numero",
                    "nome"
                ]
            },
            "Recurso_terminais_pagamento": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Provider",
                        "enum": [
                            "sumup",
                            "stripe"
                        ],
                        "x-enum-rotulos": {
                            "sumup": "SumUp",
                            "stripe": "Stripe Terminal"
                        },
                        "default": "sumup"
                    },
                    "local_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Location",
                        "description": "Empty = serves all locations.",
                        "x-anagen-recurso": "locais"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "por_emparelhar",
                            "ativo",
                            "inativo"
                        ],
                        "x-enum-rotulos": {
                            "por_emparelhar": "To be paired",
                            "ativo": "Active",
                            "inativo": "Inactive"
                        },
                        "default": "por_emparelhar"
                    },
                    "identificador": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Provider identifier",
                        "description": "Filled in when pairing.",
                        "maxLength": 120
                    },
                    "localizacao_externa": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Stripe location (tml_…)",
                        "description": "Empty = the default location in Settings.",
                        "maxLength": 120
                    },
                    "ultimo_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Last status",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "ultimo_contacto_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last contact",
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-clinico": false
            },
            "Recurso_terminais_pagamento_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "fornecedor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Provider",
                        "enum": [
                            "sumup",
                            "stripe"
                        ],
                        "x-enum-rotulos": {
                            "sumup": "SumUp",
                            "stripe": "Stripe Terminal"
                        },
                        "default": "sumup"
                    },
                    "local_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Location",
                        "description": "Empty = serves all locations.",
                        "x-anagen-recurso": "locais"
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "por_emparelhar",
                            "ativo",
                            "inativo"
                        ],
                        "x-enum-rotulos": {
                            "por_emparelhar": "To be paired",
                            "ativo": "Active",
                            "inativo": "Inactive"
                        },
                        "default": "por_emparelhar"
                    },
                    "identificador": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Provider identifier",
                        "description": "Filled in when pairing.",
                        "maxLength": 120
                    },
                    "localizacao_externa": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Stripe location (tml_…)",
                        "description": "Empty = the default location in Settings.",
                        "maxLength": 120
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Notes",
                        "maxLength": 2000
                    }
                },
                "required": [
                    "nome",
                    "fornecedor"
                ]
            },
            "Recurso_tratamentos_complementares": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Treatment",
                        "enum": [
                            "prp",
                            "minoxidil",
                            "finasterida",
                            "dutasterida",
                            "mesoterapia",
                            "laser",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "prp": "PRP",
                            "minoxidil": "Minoxidil",
                            "finasterida": "Finasteride",
                            "dutasterida": "Dutasteride",
                            "mesoterapia": "Mesotherapy",
                            "laser": "Laser",
                            "outro": "Other"
                        }
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "minimum": 1
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "End"
                    },
                    "adesao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Adherence",
                        "enum": [
                            "boa",
                            "parcial",
                            "fraca",
                            "desconhecida"
                        ],
                        "x-enum-rotulos": {
                            "boa": "Good",
                            "parcial": "Partial",
                            "fraca": "Poor",
                            "desconhecida": "Unknown"
                        },
                        "default": "desconhecida"
                    },
                    "sessoes_previstas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Planned sessions",
                        "maximum": 200,
                        "minimum": 0
                    },
                    "sessoes_feitas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Sessions completed",
                        "maximum": 200,
                        "minimum": 0,
                        "default": 0
                    },
                    "proxima_sessao_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Next session"
                    },
                    "lembretes": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Patient reminders",
                        "default": 1
                    },
                    "prescricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Prescription",
                        "maxLength": 4000,
                        "x-anagen-permissao": "ficha.clinica",
                        "x-anagen-cifrado": "clinico"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "maxLength": 4000,
                        "x-anagen-permissao": "ficha.clinica",
                        "x-anagen-cifrado": "clinico"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "acompanhamento",
                "x-anagen-clinico": true
            },
            "Recurso_tratamentos_complementares_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "tipo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Treatment",
                        "enum": [
                            "prp",
                            "minoxidil",
                            "finasterida",
                            "dutasterida",
                            "mesoterapia",
                            "laser",
                            "outro"
                        ],
                        "x-enum-rotulos": {
                            "prp": "PRP",
                            "minoxidil": "Minoxidil",
                            "finasterida": "Finasteride",
                            "dutasterida": "Dutasteride",
                            "mesoterapia": "Mesotherapy",
                            "laser": "Laser",
                            "outro": "Other"
                        }
                    },
                    "episodio_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Episode",
                        "minimum": 1
                    },
                    "inicio": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Start"
                    },
                    "fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "End"
                    },
                    "adesao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Adherence",
                        "enum": [
                            "boa",
                            "parcial",
                            "fraca",
                            "desconhecida"
                        ],
                        "x-enum-rotulos": {
                            "boa": "Good",
                            "parcial": "Partial",
                            "fraca": "Poor",
                            "desconhecida": "Unknown"
                        },
                        "default": "desconhecida"
                    },
                    "sessoes_previstas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Planned sessions",
                        "maximum": 200,
                        "minimum": 0
                    },
                    "sessoes_feitas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Sessions completed",
                        "maximum": 200,
                        "minimum": 0,
                        "default": 0
                    },
                    "proxima_sessao_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Next session"
                    },
                    "lembretes": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Patient reminders",
                        "default": 1
                    },
                    "prescricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Prescription",
                        "maxLength": 4000,
                        "x-anagen-permissao": "ficha.clinica",
                        "x-anagen-cifrado": "clinico"
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "maxLength": 4000,
                        "x-anagen-permissao": "ficha.clinica",
                        "x-anagen-cifrado": "clinico"
                    }
                },
                "required": [
                    "paciente_id",
                    "tipo",
                    "inicio"
                ]
            },
            "Recurso_tricoscopias": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "captura_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Capture",
                        "x-anagen-recurso": "capturas"
                    },
                    "marco_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Milestone",
                        "x-anagen-recurso": "marcos_acompanhamento"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Date"
                    },
                    "subzona": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Subzone",
                        "enum": [
                            "occipital",
                            "parietal_esq",
                            "parietal_dir",
                            "barba",
                            "corpo",
                            "linha_frontal",
                            "tufo_central",
                            "frontal",
                            "tempora_esq",
                            "tempora_dir",
                            "media",
                            "coroa"
                        ],
                        "x-enum-rotulos": {
                            "occipital": "Occipital",
                            "parietal_esq": "Left parietal",
                            "parietal_dir": "Right parietal",
                            "barba": "Beard",
                            "corpo": "Body",
                            "linha_frontal": "Hairline",
                            "tufo_central": "Forelock",
                            "frontal": "Frontal",
                            "tempora_esq": "Left temple",
                            "tempora_dir": "Right temple",
                            "media": "Mid-scalp",
                            "coroa": "Crown"
                        }
                    },
                    "aparelho": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Device",
                        "maxLength": 80
                    },
                    "ampliacao": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Magnification",
                        "maximum": 1000,
                        "minimum": 1,
                        "x-casas": 1
                    },
                    "area_campo_mm2": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Calibrated field area",
                        "description": "Calibrated for the device and magnification (100 mm² = 1 cm²).",
                        "maximum": 1000,
                        "minimum": 0.01,
                        "x-unidade": "mm²",
                        "x-casas": 2
                    },
                    "ponto": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Point",
                        "description": "{\"x\": 0.5, \"y\": 0.9} on the diagram (0–1) or {\"x\", \"y\", \"z\"} on the 3D model."
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Field image"
                    },
                    "uf_1": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "1-hair FU",
                        "maximum": 2000,
                        "minimum": 0,
                        "default": 0
                    },
                    "uf_2": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "2-hair FU",
                        "maximum": 2000,
                        "minimum": 0,
                        "default": 0
                    },
                    "uf_3": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "3-hair FU",
                        "maximum": 2000,
                        "minimum": 0,
                        "default": 0
                    },
                    "uf_4": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "FU with 4 or more",
                        "maximum": 2000,
                        "minimum": 0,
                        "default": 0
                    },
                    "cabelos_total": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Hairs in the field",
                        "description": "Empty: calculated from the FU (4+ counts as 4).",
                        "maximum": 10000,
                        "minimum": 0
                    },
                    "calibre_mm": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Mean calibre",
                        "maximum": 0.3,
                        "minimum": 0,
                        "x-unidade": "mm",
                        "x-casas": 4
                    },
                    "calibre_amostra": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Hairs measured for calibre",
                        "maximum": 10000,
                        "minimum": 0
                    },
                    "pct_vellus": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Vellus",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "pct_intermedios": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Intermediate",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "pct_terminais": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Terminal",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "miniaturizacao_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Miniaturisation",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "densidade_uf_cm2": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Density (FU)",
                        "x-unidade": "UF/cm²",
                        "x-casas": 1,
                        "readOnly": true
                    },
                    "densidade_cabelos_cm2": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Density (hairs)",
                        "x-unidade": "cabelos/cm²",
                        "x-casas": 1,
                        "readOnly": true
                    },
                    "cabelos_por_uf": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Hairs per FU",
                        "x-unidade": "cabelos/UF",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "valor_cobertura": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Coverage value",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "maxLength": 4000,
                        "x-anagen-cifrado": "clinico"
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "ficha.captura",
                "x-anagen-clinico": true
            },
            "Recurso_tricoscopias_Entrada": {
                "type": "object",
                "properties": {
                    "paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "captura_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Capture",
                        "x-anagen-recurso": "capturas"
                    },
                    "marco_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Milestone",
                        "x-anagen-recurso": "marcos_acompanhamento"
                    },
                    "data": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Date"
                    },
                    "subzona": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Subzone",
                        "enum": [
                            "occipital",
                            "parietal_esq",
                            "parietal_dir",
                            "barba",
                            "corpo",
                            "linha_frontal",
                            "tufo_central",
                            "frontal",
                            "tempora_esq",
                            "tempora_dir",
                            "media",
                            "coroa"
                        ],
                        "x-enum-rotulos": {
                            "occipital": "Occipital",
                            "parietal_esq": "Left parietal",
                            "parietal_dir": "Right parietal",
                            "barba": "Beard",
                            "corpo": "Body",
                            "linha_frontal": "Hairline",
                            "tufo_central": "Forelock",
                            "frontal": "Frontal",
                            "tempora_esq": "Left temple",
                            "tempora_dir": "Right temple",
                            "media": "Mid-scalp",
                            "coroa": "Crown"
                        }
                    },
                    "aparelho": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Device",
                        "maxLength": 80
                    },
                    "ampliacao": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Magnification",
                        "maximum": 1000,
                        "minimum": 1,
                        "x-casas": 1
                    },
                    "area_campo_mm2": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Calibrated field area",
                        "description": "Calibrated for the device and magnification (100 mm² = 1 cm²).",
                        "maximum": 1000,
                        "minimum": 0.01,
                        "x-unidade": "mm²",
                        "x-casas": 2
                    },
                    "ponto": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Point",
                        "description": "{\"x\": 0.5, \"y\": 0.9} on the diagram (0–1) or {\"x\", \"y\", \"z\"} on the 3D model."
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Field image"
                    },
                    "uf_1": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "1-hair FU",
                        "maximum": 2000,
                        "minimum": 0,
                        "default": 0
                    },
                    "uf_2": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "2-hair FU",
                        "maximum": 2000,
                        "minimum": 0,
                        "default": 0
                    },
                    "uf_3": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "3-hair FU",
                        "maximum": 2000,
                        "minimum": 0,
                        "default": 0
                    },
                    "uf_4": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "FU with 4 or more",
                        "maximum": 2000,
                        "minimum": 0,
                        "default": 0
                    },
                    "cabelos_total": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Hairs in the field",
                        "description": "Empty: calculated from the FU (4+ counts as 4).",
                        "maximum": 10000,
                        "minimum": 0
                    },
                    "calibre_mm": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Mean calibre",
                        "maximum": 0.3,
                        "minimum": 0,
                        "x-unidade": "mm",
                        "x-casas": 4
                    },
                    "calibre_amostra": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Hairs measured for calibre",
                        "maximum": 10000,
                        "minimum": 0
                    },
                    "pct_vellus": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Vellus",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "pct_intermedios": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Intermediate",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "pct_terminais": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Terminal",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "miniaturizacao_pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Miniaturisation",
                        "maximum": 100,
                        "minimum": 0,
                        "x-casas": 2
                    },
                    "notas": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Clinical notes",
                        "maxLength": 4000,
                        "x-anagen-cifrado": "clinico"
                    }
                },
                "required": [
                    "paciente_id",
                    "subzona",
                    "area_campo_mm2"
                ]
            },
            "Recurso_utilizadores": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email",
                        "description": "Work email used to sign in. It receives the invitation to set the password.",
                        "maxLength": 190
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone"
                    },
                    "perfil_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Profile",
                        "x-anagen-recurso": "perfis"
                    },
                    "nivel": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Level",
                        "description": "A team leader sees their team's work; management has a broader view.",
                        "enum": [
                            "colaborador",
                            "chefe_equipa",
                            "direcao"
                        ],
                        "x-enum-rotulos": {
                            "colaborador": "Staff member",
                            "chefe_equipa": "Team leader",
                            "direcao": "Management"
                        },
                        "default": "colaborador"
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "description": "Department where the person works. Empty = the profile family. Management sees the department.",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "direcao_clinica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Clinical director",
                        "description": "Approves clinical parameters, agent replies and clinical justifications.",
                        "default": 0
                    },
                    "acessos_resumo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Active permission exceptions",
                        "description": "Managed in Profiles and permissions › Per person.",
                        "readOnly": true
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Colour",
                        "description": "Colour of the person in the schedule and on the surgery board."
                    },
                    "especialidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Specialty",
                        "maxLength": 120
                    },
                    "cedula": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Professional licence",
                        "maxLength": 40
                    },
                    "ordem_profissional": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Professional body",
                        "maxLength": 60
                    },
                    "vinculo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Employment type",
                        "enum": [
                            "contrato",
                            "prestacao",
                            "socio",
                            "estagio"
                        ],
                        "x-enum-rotulos": {
                            "contrato": "Employment contract",
                            "prestacao": "Service provision",
                            "socio": "Partner",
                            "estagio": "Internship"
                        }
                    },
                    "ers_atualizar_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Update ERS registration by",
                        "description": "Deadline for updating the practitioner's registration."
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Português (Portugal)",
                            "pt-BR": "Português (Brasil)",
                            "en": "English",
                            "es": "Español",
                            "fr": "Français",
                            "de": "Deutsch"
                        },
                        "default": "pt-PT"
                    },
                    "ip_permitidos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Allowed addresses",
                        "description": "Optional. One per line: address or network (e.g. 192.168.1.0/24).",
                        "maxLength": 2000
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "totp_ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Second factor",
                        "readOnly": true
                    },
                    "ultimo_acesso_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last access",
                        "readOnly": true
                    },
                    "bloqueado_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Locked until",
                        "readOnly": true
                    },
                    "sigilo_aceite_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Confidentiality agreement accepted on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.utilizadores",
                "x-anagen-clinico": false
            },
            "Recurso_utilizadores_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 160
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "title": "Email",
                        "description": "Work email used to sign in. It receives the invitation to set the password.",
                        "maxLength": 190
                    },
                    "telefone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone"
                    },
                    "perfil_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Profile",
                        "x-anagen-recurso": "perfis"
                    },
                    "nivel": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Level",
                        "description": "A team leader sees their team's work; management has a broader view.",
                        "enum": [
                            "colaborador",
                            "chefe_equipa",
                            "direcao"
                        ],
                        "x-enum-rotulos": {
                            "colaborador": "Staff member",
                            "chefe_equipa": "Team leader",
                            "direcao": "Management"
                        },
                        "default": "colaborador"
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "description": "Department where the person works. Empty = the profile family. Management sees the department.",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Physician",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Reception"
                        }
                    },
                    "direcao_clinica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Clinical director",
                        "description": "Approves clinical parameters, agent replies and clinical justifications.",
                        "default": 0
                    },
                    "cor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "title": "Colour",
                        "description": "Colour of the person in the schedule and on the surgery board."
                    },
                    "especialidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Specialty",
                        "maxLength": 120
                    },
                    "cedula": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Professional licence",
                        "maxLength": 40
                    },
                    "ordem_profissional": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Professional body",
                        "maxLength": 60
                    },
                    "vinculo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Employment type",
                        "enum": [
                            "contrato",
                            "prestacao",
                            "socio",
                            "estagio"
                        ],
                        "x-enum-rotulos": {
                            "contrato": "Employment contract",
                            "prestacao": "Service provision",
                            "socio": "Partner",
                            "estagio": "Internship"
                        }
                    },
                    "ers_atualizar_ate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Update ERS registration by",
                        "description": "Deadline for updating the practitioner's registration."
                    },
                    "idioma": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Português (Portugal)",
                            "pt-BR": "Português (Brasil)",
                            "en": "English",
                            "es": "Español",
                            "fr": "Français",
                            "de": "Deutsch"
                        },
                        "default": "pt-PT"
                    },
                    "ip_permitidos": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Allowed addresses",
                        "description": "Optional. One per line: address or network (e.g. 192.168.1.0/24).",
                        "maxLength": 2000
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "email",
                    "perfil_id",
                    "nivel"
                ]
            },
            "Recurso_vales": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "codigo_fim": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Code (end)",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "beneficiario_nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "For",
                        "maxLength": 160
                    },
                    "comprador_nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Buyer",
                        "maxLength": 160,
                        "readOnly": true
                    },
                    "valor_inicial": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Amount",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "saldo": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Balance",
                        "x-moeda": "EUR",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "por_pagar",
                            "ativo",
                            "esgotado",
                            "expirado",
                            "anulado"
                        ],
                        "x-enum-rotulos": {
                            "por_pagar": "Unpaid",
                            "ativo": "Active",
                            "esgotado": "Used",
                            "expirado": "Expired",
                            "anulado": "Cancelled"
                        },
                        "readOnly": true
                    },
                    "validade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until",
                        "description": "Can only be extended."
                    },
                    "finalidade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Voucher type",
                        "enum": [
                            "multipla",
                            "unica"
                        ],
                        "x-enum-rotulos": {
                            "multipla": "Multi-purpose",
                            "unica": "Single-purpose"
                        },
                        "readOnly": true
                    },
                    "procedimento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Procedure",
                        "x-anagen-recurso": "procedimentos",
                        "readOnly": true
                    },
                    "comprador_paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Buyer patient",
                        "x-anagen-recurso": "pacientes",
                        "readOnly": true
                    },
                    "beneficiario_paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Beneficiary patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "mensagem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Message",
                        "maxLength": 500
                    },
                    "pagamento_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Sale payment",
                        "x-anagen-recurso": "pagamentos",
                        "readOnly": true
                    },
                    "local_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Location",
                        "x-anagen-recurso": "locais",
                        "readOnly": true
                    },
                    "ativado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Active since",
                        "readOnly": true
                    },
                    "motivo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Reason",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "financeiro.pagamentos",
                "x-anagen-clinico": false
            },
            "Recurso_vales_Entrada": {
                "type": "object",
                "properties": {
                    "beneficiario_nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "For",
                        "maxLength": 160
                    },
                    "validade": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "title": "Valid until",
                        "description": "Can only be extended."
                    },
                    "beneficiario_paciente_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Beneficiary patient",
                        "x-anagen-recurso": "pacientes"
                    },
                    "mensagem": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Message",
                        "maxLength": 500
                    }
                }
            },
            "Recurso_voz_gravacoes": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 120
                    },
                    "lingua": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Audio",
                        "description": "MP3 or WAV, up to 10 MB."
                    },
                    "texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "What the message says",
                        "description": "Used when the phone system cannot play the file.",
                        "maxLength": 2000
                    },
                    "duracao_ms": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Duration (ms)",
                        "minimum": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-clinico": false
            },
            "Recurso_voz_gravacoes_Entrada": {
                "type": "object",
                "properties": {
                    "titulo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Title",
                        "maxLength": 120
                    },
                    "lingua": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "ficheiro_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Audio",
                        "description": "MP3 or WAV, up to 10 MB."
                    },
                    "texto": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "What the message says",
                        "description": "Used when the phone system cannot play the file.",
                        "maxLength": 2000
                    },
                    "duracao_ms": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Duration (ms)",
                        "minimum": 0
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": true
                    }
                },
                "required": [
                    "titulo",
                    "lingua",
                    "ficheiro_id"
                ]
            },
            "Recurso_voz_menus": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": true
                    },
                    "predefinido": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Clinic main menu",
                        "description": "Answers numbers without their own menu."
                    },
                    "lingua": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Default language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "usar_horario_clinica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Use the clinic opening hours",
                        "default": true
                    },
                    "reconhecido": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Recognised number",
                        "enum": [
                            "menu",
                            "gestor",
                            "agente"
                        ],
                        "x-enum-rotulos": {
                            "menu": "Follow the menu",
                            "gestor": "Go straight to the case manager",
                            "agente": "Go straight to the voice agent"
                        },
                        "default": "menu"
                    },
                    "aviso_gravacao": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Say the recording notice"
                    },
                    "versao": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Version",
                        "readOnly": true
                    },
                    "publicado_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Published on",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "crm.telefonia",
                "x-anagen-clinico": false
            },
            "Recurso_voz_menus_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 255
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": true
                    },
                    "predefinido": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Clinic main menu",
                        "description": "Answers numbers without their own menu."
                    },
                    "lingua": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Default language",
                        "enum": [
                            "pt-PT",
                            "pt-BR",
                            "en",
                            "es",
                            "fr",
                            "de"
                        ],
                        "x-enum-rotulos": {
                            "pt-PT": "Portuguese",
                            "pt-BR": "Portuguese (Brazil)",
                            "en": "English",
                            "es": "Spanish",
                            "fr": "French",
                            "de": "German"
                        },
                        "default": "pt-PT"
                    },
                    "usar_horario_clinica": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Use the clinic opening hours",
                        "default": true
                    },
                    "reconhecido": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Recognised number",
                        "enum": [
                            "menu",
                            "gestor",
                            "agente"
                        ],
                        "x-enum-rotulos": {
                            "menu": "Follow the menu",
                            "gestor": "Go straight to the case manager",
                            "agente": "Go straight to the voice agent"
                        },
                        "default": "menu"
                    },
                    "aviso_gravacao": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Say the recording notice"
                    }
                },
                "required": [
                    "nome"
                ]
            },
            "Recurso_webhooks": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "title": "Address (https)",
                        "description": "Public address of the system that receives the events. Internal networks are not accepted.",
                        "maxLength": 500
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 500
                    },
                    "eventos": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "*",
                                "campanha.enviada",
                                "cirurgia.fechada",
                                "comunicado.publicado",
                                "consentimento.revogado",
                                "consulta.assinada",
                                "demonstracao.pedida",
                                "documento.assinado",
                                "documento.emitido",
                                "documento_fiscal.emitido",
                                "episodio.aberto",
                                "episodio.estado_alterado",
                                "execucao.areas_confirmadas",
                                "exportacao.concluida",
                                "formulario.respondido",
                                "incidente.registado",
                                "lead.convertido",
                                "lead.criado",
                                "lead.fase_alterada",
                                "marcacao.cancelada",
                                "marcacao.confirmada",
                                "marcacao.criada",
                                "marco.concluido",
                                "motor.versao_aprovada",
                                "paciente.criado",
                                "paciente.fundido",
                                "pagamento.recebido",
                                "pedido_titular.recebido",
                                "plano.aprovado",
                                "portal.consentimento_revogado",
                                "portal.documento_enviado",
                                "portal.fotos_enviadas",
                                "portal.pedido_criado",
                                "pre_avaliacao.recebida",
                                "proposta.aceite",
                                "proposta.enviada",
                                "proposta.recusada",
                                "reclamacao.recebida",
                                "tarefa.concluida",
                                "tarefa.criada",
                                "webhook.teste"
                            ]
                        },
                        "title": "Events",
                        "description": "Choose the events this destination receives.",
                        "x-enum-rotulos": {
                            "*": "Todos os eventos",
                            "campanha.enviada": "Campanha enviada",
                            "cirurgia.fechada": "Cirurgia fechada",
                            "comunicado.publicado": "Comunicado interno publicado",
                            "consentimento.revogado": "Consentimento retirado",
                            "consulta.assinada": "Consulta assinada",
                            "demonstracao.pedida": "Pedido de demonstração do AnagenSys",
                            "documento.assinado": "Documento assinado",
                            "documento.emitido": "Documento emitido",
                            "documento_fiscal.emitido": "Documento fiscal emitido",
                            "episodio.aberto": "Episódio de tratamento aberto",
                            "episodio.estado_alterado": "Estado do episódio alterado",
                            "execucao.areas_confirmadas": "Áreas do dia 0 confirmadas",
                            "exportacao.concluida": "Exportação total pronta",
                            "formulario.respondido": "Formulário respondido",
                            "incidente.registado": "Incidente de segurança registado",
                            "lead.convertido": "Lead convertido em paciente",
                            "lead.criado": "Lead criado",
                            "lead.fase_alterada": "Lead mudou de fase",
                            "marcacao.cancelada": "Marcação cancelada",
                            "marcacao.confirmada": "Marcação confirmada",
                            "marcacao.criada": "Marcação criada",
                            "marco.concluido": "Marco do acompanhamento concluído",
                            "motor.versao_aprovada": "Parâmetros do motor aprovados",
                            "paciente.criado": "Paciente criado",
                            "paciente.fundido": "Pacientes fundidos",
                            "pagamento.recebido": "Pagamento recebido",
                            "pedido_titular.recebido": "Pedido de titular recebido",
                            "plano.aprovado": "Plano cirúrgico aprovado",
                            "portal.consentimento_revogado": "Autorização retirada no portal",
                            "portal.documento_enviado": "Documento enviado pelo paciente",
                            "portal.fotos_enviadas": "Fotografias de acompanhamento enviadas",
                            "portal.pedido_criado": "Pedido criado no portal",
                            "pre_avaliacao.recebida": "Pré-avaliação online recebida",
                            "proposta.aceite": "Proposta aceite",
                            "proposta.enviada": "Proposta enviada",
                            "proposta.recusada": "Proposta recusada",
                            "reclamacao.recebida": "Reclamação, elogio ou sugestão recebida",
                            "tarefa.concluida": "Tarefa concluída",
                            "tarefa.criada": "Tarefa criada",
                            "webhook.teste": "Entrega de teste"
                        }
                    },
                    "segredo_prefixo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Secret (first characters)",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "segredo_visivel": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Secret",
                        "description": "Copy it into the destination system. It will not be shown again.",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "ultimo_estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Last delivery",
                        "enum": [
                            "entregue",
                            "falhada",
                            "desistida",
                            "pendente"
                        ],
                        "x-enum-rotulos": {
                            "entregue": "Delivered",
                            "falhada": "Failed (retrying)",
                            "desistida": "Unsuccessful",
                            "pendente": "Pending"
                        },
                        "readOnly": true
                    },
                    "ultima_entrega_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last delivered on",
                        "readOnly": true
                    },
                    "falhas_seguidas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Consecutive failures",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-clinico": false
            },
            "Recurso_webhooks_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Name",
                        "maxLength": 120
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "title": "Address (https)",
                        "description": "Public address of the system that receives the events. Internal networks are not accepted.",
                        "maxLength": 500
                    },
                    "descricao": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Description",
                        "maxLength": 500
                    },
                    "eventos": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "*",
                                "campanha.enviada",
                                "cirurgia.fechada",
                                "comunicado.publicado",
                                "consentimento.revogado",
                                "consulta.assinada",
                                "demonstracao.pedida",
                                "documento.assinado",
                                "documento.emitido",
                                "documento_fiscal.emitido",
                                "episodio.aberto",
                                "episodio.estado_alterado",
                                "execucao.areas_confirmadas",
                                "exportacao.concluida",
                                "formulario.respondido",
                                "incidente.registado",
                                "lead.convertido",
                                "lead.criado",
                                "lead.fase_alterada",
                                "marcacao.cancelada",
                                "marcacao.confirmada",
                                "marcacao.criada",
                                "marco.concluido",
                                "motor.versao_aprovada",
                                "paciente.criado",
                                "paciente.fundido",
                                "pagamento.recebido",
                                "pedido_titular.recebido",
                                "plano.aprovado",
                                "portal.consentimento_revogado",
                                "portal.documento_enviado",
                                "portal.fotos_enviadas",
                                "portal.pedido_criado",
                                "pre_avaliacao.recebida",
                                "proposta.aceite",
                                "proposta.enviada",
                                "proposta.recusada",
                                "reclamacao.recebida",
                                "tarefa.concluida",
                                "tarefa.criada",
                                "webhook.teste"
                            ]
                        },
                        "title": "Events",
                        "description": "Choose the events this destination receives.",
                        "x-enum-rotulos": {
                            "*": "Todos os eventos",
                            "campanha.enviada": "Campanha enviada",
                            "cirurgia.fechada": "Cirurgia fechada",
                            "comunicado.publicado": "Comunicado interno publicado",
                            "consentimento.revogado": "Consentimento retirado",
                            "consulta.assinada": "Consulta assinada",
                            "demonstracao.pedida": "Pedido de demonstração do AnagenSys",
                            "documento.assinado": "Documento assinado",
                            "documento.emitido": "Documento emitido",
                            "documento_fiscal.emitido": "Documento fiscal emitido",
                            "episodio.aberto": "Episódio de tratamento aberto",
                            "episodio.estado_alterado": "Estado do episódio alterado",
                            "execucao.areas_confirmadas": "Áreas do dia 0 confirmadas",
                            "exportacao.concluida": "Exportação total pronta",
                            "formulario.respondido": "Formulário respondido",
                            "incidente.registado": "Incidente de segurança registado",
                            "lead.convertido": "Lead convertido em paciente",
                            "lead.criado": "Lead criado",
                            "lead.fase_alterada": "Lead mudou de fase",
                            "marcacao.cancelada": "Marcação cancelada",
                            "marcacao.confirmada": "Marcação confirmada",
                            "marcacao.criada": "Marcação criada",
                            "marco.concluido": "Marco do acompanhamento concluído",
                            "motor.versao_aprovada": "Parâmetros do motor aprovados",
                            "paciente.criado": "Paciente criado",
                            "paciente.fundido": "Pacientes fundidos",
                            "pagamento.recebido": "Pagamento recebido",
                            "pedido_titular.recebido": "Pedido de titular recebido",
                            "plano.aprovado": "Plano cirúrgico aprovado",
                            "portal.consentimento_revogado": "Autorização retirada no portal",
                            "portal.documento_enviado": "Documento enviado pelo paciente",
                            "portal.fotos_enviadas": "Fotografias de acompanhamento enviadas",
                            "portal.pedido_criado": "Pedido criado no portal",
                            "pre_avaliacao.recebida": "Pré-avaliação online recebida",
                            "proposta.aceite": "Proposta aceite",
                            "proposta.enviada": "Proposta enviada",
                            "proposta.recusada": "Proposta recusada",
                            "reclamacao.recebida": "Reclamação, elogio ou sugestão recebida",
                            "tarefa.concluida": "Tarefa concluída",
                            "tarefa.criada": "Tarefa criada",
                            "webhook.teste": "Entrega de teste"
                        }
                    },
                    "ativo": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    }
                },
                "required": [
                    "nome",
                    "url",
                    "eventos"
                ]
            },
            "Recurso_webhooks_entregas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "webhook_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Destination",
                        "x-anagen-recurso": "webhooks",
                        "readOnly": true
                    },
                    "evento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Event",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "evento_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Event ID",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "estado": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Status",
                        "enum": [
                            "pendente",
                            "entregue",
                            "falhada",
                            "desistida"
                        ],
                        "x-enum-rotulos": {
                            "pendente": "Pending",
                            "entregue": "Delivered",
                            "falhada": "Failed (retrying)",
                            "desistida": "Unsuccessful"
                        },
                        "readOnly": true
                    },
                    "codigo_http": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "HTTP code",
                        "readOnly": true
                    },
                    "tentativas": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Attempts",
                        "readOnly": true
                    },
                    "duracao_ms": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "title": "Duration",
                        "x-unidade": "ms",
                        "x-casas": 2,
                        "readOnly": true
                    },
                    "proxima_tentativa_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Next attempt",
                        "readOnly": true
                    },
                    "entregue_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Delivered on",
                        "readOnly": true
                    },
                    "erro": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Error",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "resposta": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Response",
                        "readOnly": true
                    },
                    "conteudo": {
                        "type": [
                            "object",
                            "array"
                        ],
                        "title": "Content sent",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-clinico": false
            },
            "Recurso_webhooks_entregas_Entrada": {
                "type": "object",
                "properties": {}
            },
            "Recurso_whatsapp_linhas": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "readOnly": true
                    },
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Line name",
                        "maxLength": 80
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "description": "New conversations on this line go to this department.",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Doctor",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Front desk"
                        },
                        "default": "rececao"
                    },
                    "phone_number_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number identifier",
                        "description": "Identifier of the number on the Meta platform (not the phone number).",
                        "maxLength": 40,
                        "pattern": "/^[0-9 ]{6,40}$/"
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone number",
                        "description": "Filled in when the line is tested.",
                        "maxLength": 25
                    },
                    "waba_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Business account",
                        "maxLength": 40
                    },
                    "token_prefixo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Own key",
                        "description": "Last characters of the own key. Empty: uses the key from Settings › WhatsApp.",
                        "maxLength": 255,
                        "readOnly": true
                    },
                    "token_novo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "New access key",
                        "description": "Only if this line uses a different key. Stored encrypted and never shown.",
                        "maxLength": 2000
                    },
                    "token_remover": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Remove the own key"
                    },
                    "principal": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Main line",
                        "description": "Answers conversations without a line and is listed first.",
                        "default": 0
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    },
                    "ultima_mensagem_em": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "title": "Last message",
                        "readOnly": true
                    },
                    "criado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "atualizado_em": {
                        "type": "string",
                        "format": "date-time",
                        "readOnly": true
                    },
                    "_rotulos": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Readable labels of relations and choices."
                    }
                },
                "x-anagen-modulo": "admin.definicoes",
                "x-anagen-clinico": false
            },
            "Recurso_whatsapp_linhas_Entrada": {
                "type": "object",
                "properties": {
                    "nome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Line name",
                        "maxLength": 80
                    },
                    "departamento": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Department",
                        "description": "New conversations on this line go to this department.",
                        "enum": [
                            "administracao",
                            "medico",
                            "enfermagem",
                            "tecnico",
                            "comercial",
                            "rececao"
                        ],
                        "x-enum-rotulos": {
                            "administracao": "Administration",
                            "medico": "Doctor",
                            "enfermagem": "Nursing",
                            "tecnico": "Technician",
                            "comercial": "Sales",
                            "rececao": "Front desk"
                        },
                        "default": "rececao"
                    },
                    "phone_number_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Number identifier",
                        "description": "Identifier of the number on the Meta platform (not the phone number).",
                        "maxLength": 40,
                        "pattern": "/^[0-9 ]{6,40}$/"
                    },
                    "numero": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Phone number",
                        "description": "Filled in when the line is tested.",
                        "maxLength": 25
                    },
                    "waba_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "Business account",
                        "maxLength": 40
                    },
                    "token_novo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "title": "New access key",
                        "description": "Only if this line uses a different key. Stored encrypted and never shown.",
                        "maxLength": 2000
                    },
                    "token_remover": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Remove the own key"
                    },
                    "principal": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Main line",
                        "description": "Answers conversations without a line and is listed first.",
                        "default": 0
                    },
                    "ativa": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "title": "Active",
                        "default": 1
                    },
                    "ordem": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "title": "Order",
                        "maximum": 999,
                        "minimum": 0,
                        "default": 0
                    }
                },
                "required": [
                    "nome",
                    "departamento",
                    "phone_number_id"
                ]
            }
        },
        "responses": {
            "ErroValidacao": {
                "description": "Invalid data",
                "headers": {
                    "X-Request-Id": {
                        "$ref": "#/components/headers/XRequestId"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/RespostaErro"
                        },
                        "example": {
                            "ok": false,
                            "erro": {
                                "codigo": "validacao",
                                "mensagem": "Há dados por corrigir.",
                                "campos": {
                                    "email": "Indique um email válido."
                                }
                            }
                        }
                    }
                }
            },
            "NaoAutenticado": {
                "description": "Not authenticated",
                "headers": {
                    "X-Request-Id": {
                        "$ref": "#/components/headers/XRequestId"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/RespostaErro"
                        },
                        "example": {
                            "ok": false,
                            "erro": {
                                "codigo": "nao_autenticado",
                                "mensagem": "Falta o token de acesso."
                            }
                        }
                    }
                }
            },
            "SemPermissao": {
                "description": "Forbidden",
                "headers": {
                    "X-Request-Id": {
                        "$ref": "#/components/headers/XRequestId"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/RespostaErro"
                        },
                        "example": {
                            "ok": false,
                            "erro": {
                                "codigo": "sem_permissao",
                                "mensagem": "Não tem permissão para aceder a este conteúdo."
                            }
                        }
                    }
                }
            },
            "NaoEncontrado": {
                "description": "Not found",
                "headers": {
                    "X-Request-Id": {
                        "$ref": "#/components/headers/XRequestId"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/RespostaErro"
                        },
                        "example": {
                            "ok": false,
                            "erro": {
                                "codigo": "nao_encontrado",
                                "mensagem": "Não encontrado."
                            }
                        }
                    }
                }
            },
            "Conflito": {
                "description": "Conflict",
                "headers": {
                    "X-Request-Id": {
                        "$ref": "#/components/headers/XRequestId"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/RespostaErro"
                        },
                        "example": {
                            "ok": false,
                            "erro": {
                                "codigo": "conflito",
                                "mensagem": "O estado atual impede a operação."
                            }
                        }
                    }
                }
            },
            "LimiteExcedido": {
                "description": "Rate limit exceeded",
                "headers": {
                    "X-Request-Id": {
                        "$ref": "#/components/headers/XRequestId"
                    },
                    "Retry-After": {
                        "$ref": "#/components/headers/RetryAfter"
                    },
                    "X-RateLimit-Limit": {
                        "$ref": "#/components/headers/XRateLimitLimit"
                    },
                    "X-RateLimit-Remaining": {
                        "$ref": "#/components/headers/XRateLimitRemaining"
                    },
                    "X-RateLimit-Reset": {
                        "$ref": "#/components/headers/XRateLimitReset"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/RespostaErro"
                        },
                        "example": {
                            "ok": false,
                            "erro": {
                                "codigo": "limite_excedido",
                                "mensagem": "Demasiados pedidos."
                            }
                        }
                    }
                }
            },
            "ErroInterno": {
                "description": "Internal error",
                "headers": {
                    "X-Request-Id": {
                        "$ref": "#/components/headers/XRequestId"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/RespostaErro"
                        },
                        "example": {
                            "ok": false,
                            "erro": {
                                "codigo": "erro_interno",
                                "mensagem": "Ocorreu um erro inesperado."
                            }
                        }
                    }
                }
            },
            "DesafioNecessario": {
                "description": "A (new) device verification is required — CHALLENGE_REQUIRED",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "ok": {
                                    "const": false
                                },
                                "erro": {
                                    "type": "object",
                                    "properties": {
                                        "codigo": {
                                            "const": "CHALLENGE_REQUIRED"
                                        },
                                        "mensagem": {
                                            "type": "string"
                                        },
                                        "motivo": {
                                            "type": "string",
                                            "enum": [
                                                "em_falta",
                                                "expirado",
                                                "reforcado"
                                            ]
                                        },
                                        "desafio": {
                                            "$ref": "#/components/schemas/DesafioEscudo"
                                        }
                                    }
                                }
                            }
                        },
                        "example": {
                            "ok": false,
                            "erro": {
                                "codigo": "CHALLENGE_REQUIRED",
                                "mensagem": "A verificação do dispositivo tinha expirado e já foi renovada. Volte a tentar.",
                                "motivo": "expirado",
                                "desafio": {
                                    "desafio": "eyJ2IjoxLCJpZCI6….9f2c…",
                                    "salt": "3f8a1c0e9b7d4a2f6e5c1b0a9d8e7f60",
                                    "bits": 17,
                                    "nivel": 0,
                                    "valido_por": 300,
                                    "minimo_ms": 0
                                }
                            }
                        }
                    }
                }
            },
            "ContaEmEspera": {
                "description": "The account is on hold — ACCOUNT_COOLDOWN (with Retry-After)",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "ok": {
                                    "const": false
                                },
                                "erro": {
                                    "type": "object",
                                    "properties": {
                                        "codigo": {
                                            "const": "ACCOUNT_COOLDOWN"
                                        },
                                        "mensagem": {
                                            "type": "string"
                                        },
                                        "espera": {
                                            "type": "integer"
                                        }
                                    }
                                }
                            }
                        },
                        "example": {
                            "ok": false,
                            "erro": {
                                "codigo": "ACCOUNT_COOLDOWN",
                                "mensagem": "Por segurança, esta conta só aceita nova tentativa dentro de 30 segundos.",
                                "espera": 30
                            }
                        }
                    }
                }
            }
        }
    }
}